From 87eb254a1a7095728cf56b23aa3a4947fd69841c Mon Sep 17 00:00:00 2001 From: Leonardo de Moura Date: Wed, 20 Nov 2013 11:28:19 -0800 Subject: [PATCH] fix(tests/util/thread): incorrect unit test Signed-off-by: Leonardo de Moura --- src/tests/util/thread.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/tests/util/thread.cpp b/src/tests/util/thread.cpp index 4a5fd32c0..0aecceb42 100644 --- a/src/tests/util/thread.cpp +++ b/src/tests/util/thread.cpp @@ -66,10 +66,10 @@ static void tst3() { } while (!mutex.try_lock()) { std::this_thread::sleep_for(small_delay); - // test recursive try_lock - lean_verify(mutex.try_lock()); - mutex.unlock(); } + // test recursive try_lock + lean_verify(mutex.try_lock()); + mutex.unlock(); // we can only succeed getting the lock if t2 is done lean_assert(t2_done); mutex.unlock(); @@ -101,10 +101,10 @@ static void tst4() { } while (!mutex.try_lock_shared()) { std::this_thread::sleep_for(small_delay); - // test recursive try_lock_shared - lean_verify(mutex.try_lock_shared()); - mutex.unlock_shared(); } + // test recursive try_lock_shared + lean_verify(mutex.try_lock_shared()); + mutex.unlock_shared(); // we can only succeed getting the lock if t2 is done lean_assert(t2_done); mutex.unlock_shared(); @@ -165,6 +165,8 @@ static void tst5() {} #endif int main() { + tst3(); + return 0; tst1(); tst2(); tst3();