free lunch we got from Moore's Law is over. So we all have to program with concurrency in mind.
No big deal? Consider the fact that most of C++'s standard smart pointers still don't support atomic writes. Not Boost's (documentation), not Loki's (despite an MT ownership policy) not Scott Meyers's. What's that mean?
What otherwise looks like one thread owning the resource and another thread inspecting it, is actually undefined behavior.
Herb Sutter and Andrei Alexandrescu have written complex multi-part articles in the C/C++ User's Journal addressing variants of the issue, and almost always with corrections the next month. It's a topic almost impossible to get right.
The current state of the art seems to be led by Joe Seigh with his atomic_ptr. Apparently similar to patent 20060037026.
An "introductory" article can be found in the December 2004 issue of the CUJ, Atomic Reference Counting Pointers by William K. Reinholz.
We live in interesting times. The
No big deal? Consider the fact that most of C++'s standard smart pointers still don't support atomic writes. Not Boost's (documentation), not Loki's (despite an MT ownership policy) not Scott Meyers's. What's that mean?
shared_ptrp(new int(42)); // thread A (supposedly owning) p = shared_ptr (new int(1942)); // re-writes p // thread B (supposedly reading) { shared_ptr p2(p); }
What otherwise looks like one thread owning the resource and another thread inspecting it, is actually undefined behavior.
Herb Sutter and Andrei Alexandrescu have written complex multi-part articles in the C/C++ User's Journal addressing variants of the issue, and almost always with corrections the next month. It's a topic almost impossible to get right.
The current state of the art seems to be led by Joe Seigh with his atomic_ptr. Apparently similar to patent 20060037026.
An "introductory" article can be found in the December 2004 issue of the CUJ, Atomic Reference Counting Pointers by William K. Reinholz.
Comments
Not yet.