[compiler-rt] [TSan] Add lock_during_write flag on Apple platforms to avoid deadlock (PR #157928)

Dan Blackwell via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 10 11:49:21 PDT 2025


================
@@ -1649,6 +1652,13 @@ TSAN_INTERCEPTOR(int, pthread_barrier_wait, void *b) {
 
 TSAN_INTERCEPTOR(int, pthread_once, void *o, void (*f)()) {
   SCOPED_INTERCEPTOR_RAW(pthread_once, o, f);
+#if SANITIZER_APPLE
+  if (flags()->lock_during_write != kLockDuringAllWrites &&
----------------
DanBlackwell wrote:

TODO: Add a comment to explain _why_ this is necessary.

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


More information about the llvm-commits mailing list