This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]