[libc-commits] [libc] [libc] implement pthread_mutex_trylock (PR #93359)
Martin Atkins via libc-commits
libc-commits at lists.llvm.org
Sat Jan 25 07:43:56 PST 2025
apparentlymart wrote:
I found myself here while trying to understand the current implementation status of the POSIX threads API, so I'm really just a random passer-by here, but FWIW I saw the two mentions of a mutex rework patch above without any direct link to the relevant change and so I went digging and I'm _guessing_ that was referring to https://github.com/llvm/llvm-project/pull/92168, in which case that has now been merged and does appear to include an implementation of `try_lock` for Linux, here:
https://github.com/llvm/llvm-project/blob/de44a55f321814cc287e8a627f685a343e723d4f/libc/src/__support/threads/linux/mutex.h#L80-L84
https://github.com/llvm/llvm-project/blob/de44a55f321814cc287e8a627f685a343e723d4f/libc/src/__support/threads/linux/raw_mutex.h#L99-L104
However, as far as I can tell there is still (in `main` at the time of writing this comment) not an entrypoint for [`pthread_mutex_trylock`](https://pubs.opengroup.org/onlinepubs/9799919799/functions/pthread_mutex_trylock.html), and so this PR could still potentially add that in terms of the `Mutex::try_lock` function as described in the previous comment.
I'm just sharing this in case it's useful to a future visitor to this PR. I'm sorry if anything I said here is inaccurate.
https://github.com/llvm/llvm-project/pull/93359
More information about the libc-commits
mailing list