From 5b6bdc5d3f4b83aa0fd73ac353dfc82c0c4ac77d Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Fri, 28 Feb 2014 14:34:25 +0000 Subject: [PATCH] tsan: prevent actual deadlock in deadlock detector test git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@202502 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/tsan/deadlock_detector_stress_test.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/tsan/deadlock_detector_stress_test.cc b/test/tsan/deadlock_detector_stress_test.cc index 751881fb7..afecf0bf1 100644 --- a/test/tsan/deadlock_detector_stress_test.cc +++ b/test/tsan/deadlock_detector_stress_test.cc @@ -11,6 +11,7 @@ #include #include #include +#include #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); -- 2.11.4.GIT