This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/10320] erand48 implementation not thread safe but POSIX says it should be
- From: "neleai at seznam dot cz" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Thu, 20 Dec 2012 12:11:58 +0000
- Subject: [Bug libc/10320] erand48 implementation not thread safe but POSIX says it should be
- Auto-submitted: auto-generated
- References: <bug-10320-131@http.sourceware.org/bugzilla/>
http://sourceware.org/bugzilla/show_bug.cgi?id=10320
--- Comment #4 from Ondrej Bilka <neleai at seznam dot cz> 2012-12-20 12:11:58 UTC ---
Sorry that I mistaken erand48 for drand48.
Note that there is a GNU extension reentrant functions drand48_r ...
Function lcong48 changes a,c in x_{n+1}=a*x_n+c mod 2^48 congruence formula.
These are saved in __libc_drand48_data
Then erand48... read only these a,c from __libc_drand48_data.
There is indeed a race between lcong48 and *rand48 but it is mostly harmless.
Only thing that can go wrong is that when lcong48 with a',c' is called then
some seed will be updated according to formula x_{n+1}=a'*x_n+c . As then seed
is nondeterministic because both x_{n+1}=a*x_n+c , x_{n+1}=a'*x_n+c' are valid
updates.
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.