Acording to one Channel 9 E2E video(with Herb Sutter in it) in c++0x if number is atomic<int>
number++
is atomic. Can somebody confirm that is how it is in the final C++11 standard(lets pretend that it is finalized :)).
The standard is finalised, and every operation on all the standard integral specialisations of atomic<T>
is atomic.
This doesn't mean all expressions involving standard integral atomic<T>
are atomic.
number = number * 2;
is two operations:
temporary = number * 2;
number = temporary;
Each of them is atomic, but together they are not. This is what transactions/critical sections are for.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With