[libc-commits] [libc] [libc][stdlib] Remove LIBC_THREAD_LOCAL from rand_next (PR #96245)

Joseph Huber via libc-commits libc-commits at lists.llvm.org
Tue Jun 25 12:01:40 PDT 2024


jhuber6 wrote:

Looking at some other implementations, it seems like ISO C states that the random seed is per-process, but that multiple threads should be able to interfere with it? I was looking at `glibc` and this seems to be the case https://github.com/bminor/glibc/blob/master/stdlib/random.c#L287.

So, this to me seems like we'd need to implement some kind of RMW atomic on the underlying state, not just get rid of the thread_local.

https://github.com/llvm/llvm-project/pull/96245


More information about the libc-commits mailing list