From: Wolfgang 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-Tag: v8.1.0~570^2~96 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a06cac20b8086775afe5d853ff5a81f67785df8d;p=dealii.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 (); }