Email List: Xaustin-group-lX
[All Lists]

Re: re-entrancy of initstate/random/setstate/srandom

To: Simon Josefsson <jas@xxxxxxxxxxx>
Subject: Re: re-entrancy of initstate/random/setstate/srandom
From: Stephen Michell <stephen.michell@xxxxxxxxxxxx>
Date: Tue, 23 Jun 2009 23:12:38 -0400
Cc: austin-group-l@xxxxxxxxxxxxx
References: <87y6rir8h6.fsf@mocca.josefsson.org>
They must be reentrant, or rather single threaded or "protected". There is global state being maintained here (since random is called with no parameters), but if 2 threads were executing code in random, initstate, etc. and weren't protected than the seed would be corrupted.
...s

Simon Josefsson wrote:
All,

I'm reading the documentation on

http://www.opengroup.org/onlinepubs/9699919799/functions/initstate.html

but it isn't clear to me whether the functions are intended to be
re-entrant. I'm assuming that is the case because the functions are not
mentioned in the list on:

http://www.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_09_01

Do implementations in general provide re-entrant variants of these
functions?

/Simon






<Prev in Thread] Current Thread [Next in Thread>