views:

247

answers:

3

Does VC++ 2010 have support for C++0x's portable atomic type template?

+5  A: 

No; none of the C++0x atomic operations or thread support features are supported by Visual C++ 2010.

James McNellis
How evil. Do I have an alternative to the C++0x version, then?
Electro
@Electro: There is no truly portable alternative. Compiler support is required for an atomic operations library to ensure that optimizations don't violate the atomicity of the operations. You might look into [just::thread](http://www.stdthread.co.uk/) which implements the C++0x threads library and (at least parts of) the atomics library for a handful of platforms, including Visual C++ 2010 (it is not free, but also not particularly expensive).
James McNellis
@James McNellis: I am aware compiler support is required for it - well, thanks anyway, and I'm not prepared to spend money to license that for my open source engine.
Electro
A: 

You can use tbb::atomic. It is not the same as C++0x atomics, and is not really meant to be a replacement or temporary substitute for them, but can be used to accomplish the same programming tasks.

SoapBox
+1  A: 

You should check out the Concurrency Runtime. It's far more comprehensive than the offerings from the C++ standards committee, and comes in VC10. That is, of course, not particularly portable, but if you want that, then Intel's Thread Building Blocks can work for you.

DeadMG