13 Jun
2011
13 Jun
'11
10 a.m.
Andrej van der Zee wrote:
I am looking for an efficient way to use boost::intrusive_ptr in a multi-threaded application. In the source-tree I encountered the macro BOOST_INTERLOCKED_INCREMENT/DECREMENT. Should I use these too and how are these implemented in Linux?
No, you shouldn't use these macros. They are Windows-specific and correspond to InterlockedIncrement/InterlockedDecrement but don't require the inclusion of windows.h. If you are targeting the new C++0x, use std::atomic; otherwise, until Boost.Atomic is available, you may try boost::detail::atomic_count. It's, however, undocumented.