[PATCH] D14428: [tsan] Replace pthread_yield with sched_yield in lit tests

Kuba Brecka via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 6 01:34:00 PST 2015


kubabrecka created this revision.
kubabrecka added reviewers: dvyukov, kcc, samsonov, glider.
kubabrecka added subscribers: llvm-commits, zaks.anna, ismailp, jasonk, jevinskie.

OS X doesn't have `pthread_yield`.  Let's use `sched_yield` instead.

http://reviews.llvm.org/D14428

Files:
  test/tsan/atomic_free3.cc
  test/tsan/real_deadlock_detector_stress_test.cc
  test/tsan/signal_errno.cc

Index: test/tsan/signal_errno.cc
===================================================================
--- test/tsan/signal_errno.cc
+++ test/tsan/signal_errno.cc
@@ -24,7 +24,7 @@
     volatile char *p = (char*)malloc(1);
     p[0] = 0;
     free((void*)p);
-    pthread_yield();
+    sched_yield();
   }
 }
 
Index: test/tsan/real_deadlock_detector_stress_test.cc
===================================================================
--- test/tsan/real_deadlock_detector_stress_test.cc
+++ test/tsan/real_deadlock_detector_stress_test.cc
@@ -59,7 +59,7 @@
       for (;;) {
         int old = __atomic_load_n(&m->state, __ATOMIC_RELAXED);
         if (old == kStateLocked) {
-          pthread_yield();
+          sched_yield();
           continue;
         }
         int newv = old + 1;
Index: test/tsan/atomic_free3.cc
===================================================================
--- test/tsan/atomic_free3.cc
+++ test/tsan/atomic_free3.cc
@@ -13,7 +13,7 @@
   pthread_t t;
   pthread_create(&t, 0, Thread, a);
   while (__atomic_load_n(a, __ATOMIC_RELAXED) == 0)
-    pthread_yield();
+    sched_yield();
   delete a;
   pthread_join(t, 0);
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14428.39496.patch
Type: text/x-patch
Size: 1154 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151106/0a3b4658/attachment.bin>


More information about the llvm-commits mailing list