I use <thread> <atomic> <mutex>
etc heavily in my code, which includes several lock-free algorithms. I am targeting (eventually) a linux environment. I've been developing with the Visual Studio 2011 Beta, which while lacking horribly in other C++11 features, seems to be the only toolchain that implements the concurrent features.
See c++ 11 support here:
Now if the others simply lack a library containing the c++ 11 concurrent features, I can easily use just::thread, however both clang and gcc answer "no" to the c++11 memory model, which at least visual c++ seems to support. I'm not exactly sure what the effect of this would be - probably optimizing away of apparently side effect free code, among other erroneous things.
If for now I completely avoid optimized builds and compile only debug builds without optimizations enabled - is it reasonable to use the Clang or GCC toolchain?
just::thread
, it'll work fine. It uses the native (Posix or Win32) primitives to enforce things like ordering, so I think a compiler would have to be pretty badly broken in general for it to fail. – Cowcatcherjust::thread
so that it would be cross-platform, so I would not expect any issue. – Knack