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

Peter Dimov pdimov@mmltd.net
Tue Mar 29 15:49:00 GMT 2005


Alexander Terekhov wrote:
> [...  __release/acquire_memory_barrier() ...]
>
>> The only reliable implementation of these barriers that I see
>> is an empty pthread_mutex_lock/pthread_mutex_unlock pair.
>
> Nope. That won't work. It just proves once again that non-label
> notation for acquire/release (and others more relaxed
> unidirectional) constraints sucks miserably. It's akin to
> abuse of pthread_barrier_wait().
>
> http://www.opengroup.org/austin/mailarchives/ag/msg07595.html
> http://www.opengroup.org/austin/mailarchives/ag/msg07604.html
> http://www.opengroup.org/austin/mailarchives/ag/msg07593.html

Just to clarify, when you say "won't work", do you mean that it is not 
guaranteed to work by POSIX, or that there is a platform, supported by 
libstdc++, where it doesn't work? 



More information about the Libstdc++ mailing list