[fpc-devel] Random thread-safe
Jonas Maebe
jonas.maebe at elis.ugent.be
Thu Jan 28 19:13:56 CET 2016
Mark Morgan Lloyd wrote:
> Could I ask for clarification of this please. Are you saying that
> Random() will crash if called simultaneously by multiple threads, or
> that it will return suboptimal results?
It's undefined. The current implementation won't crash, but the results
will indeed be suboptimal.
> If, as an example, I have two threads doing network or comms jobs and I
> want to introduce jitter in the retries, does that mean that I have to
> put Random() into a critical section?
Yes.
Jonas
More information about the fpc-devel
mailing list