tr1::shared_ptr and v3's atomic ops
Jonathan Wakely
cow@compsoc.man.ac.uk
Thu Mar 24 16:38:00 GMT 2005
I have a patch to fix a MT race condition in tr1::shared_ptr.
I haven't tested it since Benjamin re-organised the headers, I'll do so
whehn I get home tonight, and will post it here later.
In the meantime...
Since I incorporated shared_ptr into v3 Peter Dimov has modified the
Boost version so that (on Windows) it doesn't use any locks. I had
already done something similar for the version I added to v3, except
that I couldn't make shared_count::add_ref_lock() lock-free, since
v3's atomic compare_and_swap() was removed some years ago:
http://gcc.gnu.org/ml/gcc-patches/2001-10/msg00215.html
I have two questions about this
1) could compare_and_swap be resurrected, or is the porting headache too
much bother?
2) Do the v3 atomic ops give any guarantees about memory synchronisation
on systems with relaxed memory visibility rules ? Peter Dimov has asked
on the Boost list for help regarding v3's atomic ops, as he wants to
have a lock-free shared_ptr on unix as well as on Windows:
http://lists.boost.org/MailArchives/boost/msg81481.php
jon
--
"The following story is true. By which I mean false. It's all lies.
But they're entertaining lies. And in the end, isn't that the real truth.
The answer, is no."
- Leonard Nimoy, in "The Simpsons"
More information about the Libstdc++
mailing list