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: [Patch/RFC] tr1::shared_ptr<> removal of lock, choosing thread safety


Peter Dimov wrote:
> In addition to your test, you might consider something along the lines of
> 
> http://www.boost.org/libs/smart_ptr/test/weak_ptr_mt_test.cpp
> 
> It's still a probabilistic approach, but with a slightly better coverage
> of the possible races.

I've had a look at this now; looks like a good idea. However, I was
under the impression that rand() wasn't thread safe as it maintains
internal state?

The comment at the end of
http://www.gnu.org/software/libc/manual/html_mono/libc.html#ISO%20Random
seems to imply that it's not safe to use rand(), though I could be
interpreting it wrongly, it seems a bit cryptic.

I'll try and implement something like this as well, though with a safe RNG.

~phil


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