summary refs log tree commit diff
path: root/nptl/pthread_cond_destroy.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-12-22 20:10:10 +0000
committerUlrich Drepper <drepper@redhat.com>2004-12-22 20:10:10 +0000
commita334319f6530564d22e775935d9c91663623a1b4 (patch)
treeb5877475619e4c938e98757d518bb1e9cbead751 /nptl/pthread_cond_destroy.c
parent0ecb606cb6cf65de1d9fc8a919bceb4be476c602 (diff)
downloadglibc-a334319f6530564d22e775935d9c91663623a1b4.tar.gz
glibc-a334319f6530564d22e775935d9c91663623a1b4.tar.xz
glibc-a334319f6530564d22e775935d9c91663623a1b4.zip
(CFLAGS-tst-align.c): Add -mpreferred-stack-boundary=4.
Diffstat (limited to 'nptl/pthread_cond_destroy.c')
-rw-r--r--nptl/pthread_cond_destroy.c30
1 files changed, 5 insertions, 25 deletions
diff --git a/nptl/pthread_cond_destroy.c b/nptl/pthread_cond_destroy.c
index 3e4ec8d0e4..0208d18ce4 100644
--- a/nptl/pthread_cond_destroy.c
+++ b/nptl/pthread_cond_destroy.c
@@ -44,35 +44,15 @@ __pthread_cond_destroy (cond)
      broadcasted, but still are using the pthread_cond_t structure,
      pthread_cond_destroy needs to wait for them.  */
   unsigned int nwaiters = cond->__data.__nwaiters;
-
-  if (nwaiters >= (1 << COND_CLOCK_BITS))
+  while (nwaiters >= (1 << COND_CLOCK_BITS))
     {
-      /* Wake everybody on the associated mutex in case there are
-         threads that have been requeued to it.
-         Without this, pthread_cond_destroy could block potentially
-         for a long time or forever, as it would depend on other
-         thread's using the mutex.
-         When all threads waiting on the mutex are woken up, pthread_cond_wait
-         only waits for threads to acquire and release the internal
-         condvar lock.  */
-      if (cond->__data.__mutex != NULL
-	  && cond->__data.__mutex != (void *) ~0l)
-	{
-	  pthread_mutex_t *mut = (pthread_mutex_t *) cond->__data.__mutex;
-	  lll_futex_wake (&mut->__data.__lock, INT_MAX);
-	}
-
-      do
-	{
-	  lll_mutex_unlock (cond->__data.__lock);
+      lll_mutex_unlock (cond->__data.__lock);
 
-	  lll_futex_wait (&cond->__data.__nwaiters, nwaiters);
+      lll_futex_wait (&cond->__data.__nwaiters, nwaiters);
 
-	  lll_mutex_lock (cond->__data.__lock);
+      lll_mutex_lock (cond->__data.__lock);
 
-	  nwaiters = cond->__data.__nwaiters;
-	}
-      while (nwaiters >= (1 << COND_CLOCK_BITS));
+      nwaiters = cond->__data.__nwaiters;
     }
 
   return 0;