[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
       
    Thu Jun 20 15:51:53 PDT 2024
    
    
  
jhuber6 wrote:
You know, looking into this it's baffling that POSIX made `rand_r` to be reentrant but made it take an `unsigned *r` instead of some opaque type defined by the implementation, so it's effectively unusable.
For the GPU, it's unlikely people would be able to use this seriously if it's not thread safe, but the thread local hack isn't really serviceable either. It's prefer a functional reentrant version above anything else. I thought `LIBC_THREAD_LOCAL` was just empty on platforms that didn't support it (baremetal) so this is a no-op?
https://github.com/llvm/llvm-project/pull/96245
    
    
More information about the libc-commits
mailing list