about summary refs log tree commit diff
path: root/nptl/sysdeps/pthread/pthread_cond_wait.c
diff options
context:
space:
mode:
Diffstat (limited to 'nptl/sysdeps/pthread/pthread_cond_wait.c')
-rw-r--r--nptl/sysdeps/pthread/pthread_cond_wait.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/nptl/sysdeps/pthread/pthread_cond_wait.c b/nptl/sysdeps/pthread/pthread_cond_wait.c
index 399cee89ee..78fcc7f6c6 100644
--- a/nptl/sysdeps/pthread/pthread_cond_wait.c
+++ b/nptl/sysdeps/pthread/pthread_cond_wait.c
@@ -34,6 +34,7 @@ struct _condvar_cleanup_buffer
   pthread_mutex_t *mutex;
 };
 
+
 void
 __attribute__ ((visibility ("hidden")))
 __condvar_cleanup (void *arg)
@@ -49,6 +50,16 @@ __condvar_cleanup (void *arg)
   ++cbuffer->cond->__data.__wakeup_seq;
   ++cbuffer->cond->__data.__woken_seq;
 
+  /* Wake everybody to make sure no condvar signal gets lost.  */
+#if BYTE_ORDER == LITTLE_ENDIAN
+  int *futex = ((int *) (&cbuffer->cond->__data.__wakeup_seq));
+#elif BYTE_ORDER == BIG_ENDIAN
+  int *futex = ((int *) (&cbuffer->cond->__data.__wakeup_seq)) + 1;
+#else
+# error "No valid byte order"
+#endif
+  lll_futex_wake (futex, INT_MAX);
+
   /* We are done.  */
   lll_mutex_unlock (cbuffer->cond->__data.__lock);