[libc-commits] [libc] [libc] rework mutex (PR #92168)

Michael Jones via libc-commits libc-commits at lists.llvm.org
Tue May 14 16:23:02 PDT 2024


https://github.com/michaelrj-google requested changes to this pull request.

I'm fine with the idea of having a raw mutex that other mutexes inherit from, but I'm not sure if the implementation of `raw_mutex` here is correct. Here's the posix standard on the behavior of the lock, trylock, and unlock functions: https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_mutex_lock.html

My main concern is around `spin`. Generally it's better to let the kernel handle waiting (and possibly spinning) when possible, also 100 loops will take practically no time.

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


More information about the libc-commits mailing list