about summary refs log tree commit diff
path: root/nptl
diff options
context:
space:
mode:
Diffstat (limited to 'nptl')
-rw-r--r--nptl/tst-cond25.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/nptl/tst-cond25.c b/nptl/tst-cond25.c
index d80d8f7e76..be0bec484d 100644
--- a/nptl/tst-cond25.c
+++ b/nptl/tst-cond25.c
@@ -40,7 +40,15 @@ pthread_cond_t cond;
 
 void cleanup (void *u)
 {
-  /* pthread_cond_wait should always return with the mutex locked.  */
+  /* pthread_cond_wait should always return with the mutex locked.  The
+     pthread_mutex_unlock implementation does not actually check whether we
+     own the mutex for several mutex kinds, so check this explicitly.  */
+  int ret = pthread_mutex_trylock (&mutex);
+  if (ret != EDEADLK && ret != EBUSY)
+    {
+      printf ("mutex not locked in cleanup %d\n", ret);
+      abort ();
+    }
   if (pthread_mutex_unlock (&mutex))
     abort ();
 }