[libc-commits] [libc] [libc] Make 'rand()' thread-safe using atomics instead of TLS (PR #96692)

Nick Desaulniers via libc-commits libc-commits at lists.llvm.org
Wed Jun 26 09:35:14 PDT 2024


nickdesaulniers wrote:

We do have `libc/src/stdlib/baremetal/abort.cpp`, perhaps it's time for `libc/src/stdlib/baremetal/rand.cpp`?

> but even that might have some MT targets.
> make baremetal submit a new config COPT_MT_UNSAFE or similar.

If the C standard makes no guarantee, then let baremetal callers of rand use their own locking _if_ they need MT safety.  Until we have customers asking for baremetal MT safety, I'd prefer to keep the number of configurations (and thus combinations of libc to test) at a minimum.

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


More information about the libc-commits mailing list