This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [Patch/RFC] tr1::shared_ptr<> removal of lock, choosing thread safety
- From: Phillip Jordan <phillip dot m dot jordan at gmail dot com>
- To: Peter Dimov <pdimov at mmltd dot net>
- Cc: libstdc++ at gcc dot gnu dot org
- Date: Sat, 08 Jul 2006 02:10:07 +0100
- Subject: Re: [Patch/RFC] tr1::shared_ptr<> removal of lock, choosing thread safety
- References: <44AD1E9B.4070801@gmail.com> <004401c6a111$5844d5e0$6701a8c0@pdimov>
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