Fw: [patch] Make std::tr1::shared_ptr thread-safe.

Alexander Terekhov alexander.terekhov@gmail.com
Sat Apr 2 20:23:00 GMT 2005


On Apr 2, 2005 9:43 PM, Paolo Carlini <pcarlini@suse.de> wrote:
[...]
> Therefore, I think we can safely say that Jonathan patch is OK, or at
> least not worse, from the MT point of view than the rest of the library

Both are broken. Because your current __exchange_and_add() doesn't
provide suffiecent msync semantics for basic thread-safety of refcounting 
immutable objects. 

Pirate (sink and hoist) talk aside for a moment, in Sparc RMO terms, 
it needs

  membar load-store   
  <compound atomic load-modify-store>
  membar store-store 

to "preserve" the order of preceding loads and subsequent stores 
with respect to "dumb" (no value dependent msync) refcount 
decrement.

regards,
alexander.



More information about the Libstdc++ mailing list