Boost logo

Boost Users :

Subject: Re: [Boost-users] intrusive_ptr and multi-threading
From: Peter Dimov (pdimov_at_[hidden])
Date: 2011-06-13 06:00:09


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.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net