
I was surprised to see that the Boost distribution doesn't have the "atomic" operations library. I expected it to be part of the Threading, modeled on the C++0x draft. I found http://www.chaoticmind.net/~hcb/projects/boost.atomic/ via Google, from 2009. But N3225=10-0215 (is there a later Draft available ?) §29.2 shows lots of change bars, and the <atomic> header seems completely redone, it appears to make everything nicely templatated. I wonder if this is at all up-to-date, or why it's not already more officially part of Boost. Does anybody know? More to the point, I want to write some code that is portable across platforms, including emerging platforms like tablets which I expect will be more varied in their CPU architecture. I've been spoiled with writing x86-only for so many years! It makes sense to use the constructs that will be shipped with the compiler some day. So, where can I find that? —John

I was surprised to see that the Boost distribution doesn't have the "atomic" operations library. I expected it to be part of the Threading, modeled on the C++0x draft.
I found http://www.chaoticmind.net/~hcb/projects/boost.atomic/ via Google, from 2009. But N3225=10-0215 (is there a later Draft available ?) §29.2 shows lots of change bars, and the <atomic> header seems completely redone, it appears to make everything nicely templatated.
I wonder if this is at all up-to-date, or why it's not already more officially part of Boost. Does anybody know? More to the point, I want to write some code that is portable across platforms, including emerging platforms like tablets which I expect will be more varied in their CPU architecture. I've been spoiled with writing x86-only for so many years! It makes sense to use the constructs that will be shipped with the compiler some day. So, where can I find that?
i am using boost.atomic heavily for boost.lockfree, which is going to be reviewed in july. for now i am maintaining a patched version of boost.atomic as part of the boost.lockfree repository. not sure, how well boost.atomic matches the c++0x draft (i did not check the recent modifications of document in detail), but the main part, the atomic<> class is provided. however i am not sure, how well supported boost.atomic is in general. i have fixed a few issues recently and sent patches to the original author, but never heard back from him. also the library was submitted for review, but it seem it has been removed from the review schedule :/ unfortunately i do not know any compiler which already implements c++0x atomics, so if your platform is supported by boost.atomic, it is probably the best solution until real c++0x atomics are widely available ... tim

Tim Blechmann
unfortunately i do not know any compiler which already implements c++0x atomics, so if your platform is supported by boost.atomic, it is probably the best solution until real c++0x atomics are widely available ...
FYI: My commercial just::thread implementation of C++0x threads provides C++0x atomics. It is available for gcc 4.5.2/mingw, Visual Studio 2005 and later, gcc 4.3/4.4/4.5/4.6 on x86 Linux and MacPorts gcc 4.3/4.4/4.5 for 32-bit x86 MacOSX. Anthony -- Author of C++ Concurrency in Action http://www.stdthread.co.uk/book/ just::thread C++0x thread library http://www.stdthread.co.uk Just Software Solutions Ltd http://www.justsoftwaresolutions.co.uk 15 Carrallack Mews, St Just, Cornwall, TR19 7UL, UK. Company No. 5478976

unfortunately i do not know any compiler which already implements c++0x atomics, so if your platform is supported by boost.atomic, it is probably the best solution until real c++0x atomics are widely available ...
FYI: My commercial just::thread implementation of C++0x threads provides C++0x atomics. It is available for gcc 4.5.2/mingw, Visual Studio 2005 and later, gcc 4.3/4.4/4.5/4.6 on x86 Linux and MacPorts gcc 4.3/4.4/4.5 for 32-bit x86 MacOSX.
... well this is neither an option for boost.lockfree ... nor for any open source project ... tim

Tim Blechmann
unfortunately i do not know any compiler which already implements c++0x atomics, so if your platform is supported by boost.atomic, it is probably the best solution until real c++0x atomics are widely available ...
FYI: My commercial just::thread implementation of C++0x threads provides C++0x atomics. It is available for gcc 4.5.2/mingw, Visual Studio 2005 and later, gcc 4.3/4.4/4.5/4.6 on x86 Linux and MacPorts gcc 4.3/4.4/4.5 for 32-bit x86 MacOSX.
... well this is neither an option for boost.lockfree ... nor for any open source project ...
You can't rely on it being present, that is true. You could use it if it was, though, with either a user macro or some detection logic to make the choice. Anthony -- Author of C++ Concurrency in Action http://www.stdthread.co.uk/book/ just::thread C++0x thread library http://www.stdthread.co.uk Just Software Solutions Ltd http://www.justsoftwaresolutions.co.uk 15 Carrallack Mews, St Just, Cornwall, TR19 7UL, UK. Company No. 5478976

On 06/19/2011 09:02 AM, Tim Blechmann wrote:
unfortunately i do not know any compiler which already implements c++0x atomics, so if your platform is supported by boost.atomic, it is probably the best solution until real c++0x atomics are widely available ...
I'm happily using c++0x atomics with g++ and libstdc++ 4.6.0 and haven't found any missing bits yet. - Marsh

unfortunately i do not know any compiler which already implements c++0x atomics, so if your platform is supported by boost.atomic, it is probably the best solution until real c++0x atomics are widely available ...
I'm happily using c++0x atomics with g++ and libstdc++ 4.6.0 and haven't found any missing bits yet.
the implementation is incomplete (compare [1]). compiling boost.lockfree with g++-4.6 using c++0x atomics results in lots of undefined references to std::atomic<> members ... tim [1] http://gcc.gnu.org/projects/cxx0x.html
participants (5)
-
Anthony Williams
-
Igor R
-
John M. Dlugosz
-
Marsh Ray
-
Tim Blechmann