[compiler-rt] r202502 - tsan: prevent actual deadlock in deadlock detector test

Dmitry Vyukov dvyukov at google.com
Fri Feb 28 06:34:25 PST 2014


Author: dvyukov
Date: Fri Feb 28 08:34:25 2014
New Revision: 202502

URL: http://llvm.org/viewvc/llvm-project?rev=202502&view=rev
Log:
tsan: prevent actual deadlock in deadlock detector test


Modified:
    compiler-rt/trunk/test/tsan/deadlock_detector_stress_test.cc

Modified: compiler-rt/trunk/test/tsan/deadlock_detector_stress_test.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/tsan/deadlock_detector_stress_test.cc?rev=202502&r1=202501&r2=202502&view=diff
==============================================================================
--- compiler-rt/trunk/test/tsan/deadlock_detector_stress_test.cc (original)
+++ compiler-rt/trunk/test/tsan/deadlock_detector_stress_test.cc Fri Feb 28 08:34:25 2014
@@ -11,6 +11,7 @@
 #include <assert.h>
 #include <stdlib.h>
 #include <stdio.h>
+#include <unistd.h>
 
 #ifndef LockType
 #define LockType PthreadMutex
@@ -412,7 +413,7 @@ class LockTest {
  private:
   void Lock2(size_t l1, size_t l2) { L(l1); L(l2); U(l2); U(l1); }
   void Lock_0_1() { Lock2(0, 1); }
-  void Lock_1_0() { Lock2(1, 0); }
+  void Lock_1_0() { sleep(1); Lock2(1, 0); }
   void Lock1_Loop(size_t i, size_t n_iter) {
     for (size_t it = 0; it < n_iter; it++) {
       // if ((it & (it - 1)) == 0) fprintf(stderr, "%zd", i);





More information about the llvm-commits mailing list