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


Phillip Jordan wrote:
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?

http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/stdlib/random.c?rev=1.18&content-type=text/x-cvsweb-markup&cvsroot=glibc


says that

/* POSIX.1c requires that there is mutual exclusion for the `rand' and
  `srand' functions to prevent concurrent calls from modifying common
  data.  */

and seems to have a lock around __random, which rand calls.


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