Corinna Vinschen wrote:
> Ok, I pushed a Cygwin-only patch for now, which calls Cygwin's random(3)
> functions to implement rand(3), just as GLibC does it.
Thanks!
--
Problem reports: https://cygwin.com/problems.html
FAQ: https://cygwin.com/faq/
Documentation:htt
On Nov 14 12:52, Bruno Haible wrote:
> Corinna Vinschen wrote:
> > > My understanding of this paragraph is:
> > > - If an application wants 1., they can use rand_r with SEED pointing
> > > to a global variable.
> > > - If an application wants 2., they can use rand_r with SEED pointing
> > >
Corinna Vinschen wrote:
> > My understanding of this paragraph is:
> > - If an application wants 1., they can use rand_r with SEED pointing
> > to a global variable.
> > - If an application wants 2., they can use rand_r with SEED pointing
> > to a per-thread variable.
>
> The problem I
On Nov 13 17:14, Glenn Strauss wrote:
> On Mon, Nov 13, 2023 at 10:33:48PM +0100, Bruno Haible via Cygwin wrote:
> > POSIX does not have these two sentences, but instead has:
> >
> > "The rand() function need not be thread-safe."
>
> I read the above as requiring *reentrancy*, but not *thread-s
Hi Bruno,
On Nov 13 22:33, Bruno Haible via Cygwin wrote:
> Corinna Vinschen wrote:
> > https://pubs.opengroup.org/onlinepubs/9699919799/functions/rand.html
> > [...]
> > With regard to rand(), there are two different behaviors that may be
> > wanted in a multi-threaded program:
> >
> > 1.
On Mon, Nov 13, 2023 at 10:33:48PM +0100, Bruno Haible via Cygwin wrote:
> Corinna Vinschen wrote:
> > I took a look into POSIX and I'm a bit puzzled now. From
> > https://pubs.opengroup.org/onlinepubs/9699919799/functions/rand.html
>
> Part of the confusion is that POSIX and ISO C have slightly
Corinna Vinschen wrote:
> I took a look into POSIX and I'm a bit puzzled now. From
> https://pubs.opengroup.org/onlinepubs/9699919799/functions/rand.html
Part of the confusion is that POSIX and ISO C have slightly different
wording. This POSIX page says:
"The functionality described on this re
IMHO:
> 2. A different sequence
The word "different" in this context is ambiguous: is it "unrelated" as a
generator, or is it "not the same" sequence of the actual numbers?
> I read this as the newlib technique being one way of correctly implementing
> rand/srand, no?
If the first, then yes
On Nov 13 15:38, Corinna Vinschen wrote:
> On Nov 13 15:25, Bruno Haible wrote:
> > Corinna Vinschen wrote:
> > > The rand() function would still not use locking but AFAICS that's
> > > not actually required by POSIX or ISO C.
> >
> > Correct. Those who want an MT-safe rand-like function need to u
On Nov 13 15:25, Bruno Haible wrote:
> Corinna Vinschen wrote:
> > The rand() function would still not use locking but AFAICS that's
> > not actually required by POSIX or ISO C.
>
> Correct. Those who want an MT-safe rand-like function need to use random(),
> not rand().
FTR, we have to differ he
Corinna Vinschen wrote:
> The rand() function would still not use locking but AFAICS that's
> not actually required by POSIX or ISO C.
Correct. Those who want an MT-safe rand-like function need to use random(),
not rand().
Bruno
--
Problem reports: https://cygwin.com/problems.html
FAQ:
[redirecting to the newlib mailing list]
This is long-standing code in newlib, not actually inside Cygwin.
On Nov 10 21:19, Bruno Haible via Cygwin wrote:
> ISO C 23 § 7.24.2.1 and 7.24.2.2 document how rand() and srand() are
> expected to behave. In particular:
> "The srand function uses the
On 11/11/2023 1:25 PM, René Berber via Cygwin wrote:
On 11/11/2023 10:50 AM, Allen, Norton T. via Cygwin wrote:
[snip]
The srand function is not required to avoid data races with other
calls to pseudo-random sequence generation functions. ..."
That is not the same as "... required never to
On 11/11/2023 10:50 AM, Allen, Norton T. via Cygwin wrote:
[snip]
The srand function is not required to avoid data races with other
calls to pseudo-random sequence generation functions. ..."
That is not the same as "... required never to avoid data races ...".
"not required" means the sent
On 11/10/2023 5:27 PM, Bruno Haible wrote:
Norton Allen wrote:
Cygwin/(newlib?) has chosen to avoid race conditions by making
pseudo-random sequences in different threads independent. Although the
standard does not require this, it does not prohibit it either.
I disagree. I cited the relevant s
Norton Allen wrote:
> Cygwin/(newlib?) has chosen to avoid race conditions by making
> pseudo-random sequences in different threads independent. Although the
> standard does not require this, it does not prohibit it either.
I disagree. I cited the relevant sentences from the standard.
Other pla
On 11/10/2023 3:19 PM, Bruno Haible via Cygwin wrote:
ISO C 23 § 7.24.2.1 and 7.24.2.2 document how rand() and srand() are
expected to behave. In particular:
"The srand function uses the argument as a seed for a new sequence
of pseudo-random numbers to be returned by subsequent calls to ra
ISO C 23 § 7.24.2.1 and 7.24.2.2 document how rand() and srand() are
expected to behave. In particular:
"The srand function uses the argument as a seed for a new sequence
of pseudo-random numbers to be returned by subsequent calls to rand.
If srand is then called with the same seed value, t
18 matches
Mail list logo