Fw: [patch] Make std::tr1::shared_ptr thread-safe.
Peter Dimov
pdimov@mmltd.net
Sat Apr 2 20:33:00 GMT 2005
Paolo Carlini wrote:
> Peter Dimov wrote:
>
>> I'll try to review basic_string and locale::facet so that I can speak
>> in less general terms.
>
> Yes, by now I think I understand the issue at large. Of course a
> review of the usages in basic_string and locale::facet is very
> welcome.
>From what I see... it's extremely unlikely that the issue will cause
problems in practice. I can't come up with a realistic example that has even
a small chance to "fail".
Constructing such tests with shared_ptr is relatively easier because I can
vary the object destructor, something like
struct X
{
int v;
X(): v( 0 ) {}
~X() { v = 1; }
};
and with several billion repetitions of
assert( px->v == 0 );
px.reset();
from two threads simultaneously on an Alpha MP machine it might fail. Even
this isn't easy to set up, because the two threads need to execute their
sequences at exactly the same time using two shared_ptr instances sharing
ownership of the same object.
More information about the Libstdc++
mailing list