-2

My platform is vs2010 win2003 server, I have an application working well. There is an integer protected by a critical section, when I modify and use boost::detail::spinlock instead then it goes to dead lock.

magicyang
  • 453
  • 1
  • 5
  • 14

1 Answers1

2
  1. It's boost::detail::spinlock. That means it's intended for internal use only. If you want portable replacement for critical sections, use boost::mutex from Boost.Thread.

  2. It's boost::detail::spinlock. Spinlocks usually busy-wait, which makes them faster, but usable only under tightly controlled conditions.

  3. Boost 1.53 (the latest release) finally got Boost.Atomic, which is a portable (and C++11 compatible) replacement for interlocked operations.

Jan Hudec
  • 73,652
  • 13
  • 125
  • 172
  • If it's only for internal use, maybe it's collapse with the smart pointer or others. I'll try the latest boost, thank you. – magicyang Feb 05 '13 at 07:53
  • 1
    @magicyang: Boost often reimplements bits of generic infrastructure in the `details` subnamespace to keep the components independent. But doing this it makes various complex assumptions that are only true about the boost code, which makes these bits unusable in your own code. – Jan Hudec Feb 05 '13 at 08:04