From 8b4956680850a57e568b0905e1653ef264d63222 Mon Sep 17 00:00:00 2001 From: bangerth Date: Tue, 8 Oct 2013 12:46:17 +0000 Subject: [PATCH] Release mutex on the same thread that acquired it, to satisfy POSIX requirements. git-svn-id: https://svn.dealii.org/branches/branch_port_the_testsuite@31170 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/base/thread_validity_08.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/base/thread_validity_08.cc b/tests/base/thread_validity_08.cc index 2f878089b6..2f4bbe18fe 100644 --- a/tests/base/thread_validity_08.cc +++ b/tests/base/thread_validity_08.cc @@ -31,7 +31,11 @@ int spin_lock = 0; void worker () { + // wait for the mutex to make sure the main + // thread has already moved on. we can immediately + // release the mutex again. mutex.acquire (); + mutex.release (); deallog << "OK." << std::endl; spin_lock = 1; } @@ -70,8 +74,4 @@ int main() // wait for thread to finish while (spin_lock == 0) ; - - // release the lock that the thread - // acquired to avoid pthread errors - mutex.release (); } -- 2.39.5