From: bangerth Date: Tue, 8 Oct 2013 12:46:17 +0000 (+0000) Subject: Release mutex on the same thread that acquired it, to satisfy POSIX requirements. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8b4956680850a57e568b0905e1653ef264d63222;p=dealii-svn.git 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 --- 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 (); }