mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-16 15:26:47 +00:00

Fixes #83561. When a thread is blocked on a mutex and we send an async signal to that mutex, it never arrives because tsan thinks that `pthread_mutex_lock` is not a blocking function. This patch marks `pthread_*_lock` functions as blocking so we can successfully deliver async signals like `SIGPROF` when the thread is blocked on them. See the issue also for more details. I also added a test, which is a simplified version of the compiler explorer example I posted in the issue. Please let me know if you have any other ideas or things to improve! Happy to work on them. Also I filed #83844 which is more tricky because we don't have a libc wrapper for `SYS_futex`. I'm not sure how to intercept this yet. Please let me know if you have ideas on that as well. Thanks!