Boost logo

Boost :

From: Howard Hinnant (hinnant_at_[hidden])
Date: 2004-04-25 09:38:35

On Apr 25, 2004, at 6:52 AM, Peter Dimov wrote:

>> In the std::locale implementation I am careful to wrap each use of the
>> locale implementation with a mutex lock. I believe I would have to do
>> this whether or not shared_ptr protected its count. And yet
>> std::locale is just a library, not an application.
> I am not sure whether you can skip the count synchronization here. Even
> though you do not expose a shared_ptr directly, the user can still
> copy a
> std::locale at will. When two threads copy the same std::locale at the
> same
> time, a non-synchronized count leads to undefined behavior.

I don't think I was clear. The access is synchronized. The
synchronization happens at the locale level, making the synchronization
at the shared_ptr level redundant. I need to synchronize more than
just the counts in the shared_ptr, namely access to the stuff that the
shared_ptr is pointing to.


Boost list run by bdawes at, gregod at, cpdaniel at, john at