about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2020-02-09 19:19:25 +0000
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2020-02-09 19:24:42 +0000
commitfaae4b2bdd692d929037c80c3315f716f02f3b00 (patch)
tree7d29a9edf4af980bab7b03019e0611fcad5c14e4
parentcd94860c56f8a463b93f2d7ec0c588a0259884fc (diff)
downloadglibc-faae4b2bdd692d929037c80c3315f716f02f3b00.tar.gz
glibc-faae4b2bdd692d929037c80c3315f716f02f3b00.tar.xz
glibc-faae4b2bdd692d929037c80c3315f716f02f3b00.zip
htl: make pthread_cond_destroy return EBUSY on waiters
-rw-r--r--sysdeps/htl/pt-cond-destroy.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/sysdeps/htl/pt-cond-destroy.c b/sysdeps/htl/pt-cond-destroy.c
index 62cc77b0d2..b28e7e1ada 100644
--- a/sysdeps/htl/pt-cond-destroy.c
+++ b/sysdeps/htl/pt-cond-destroy.c
@@ -22,7 +22,14 @@
 int
 __pthread_cond_destroy (pthread_cond_t *cond)
 {
-  return 0;
+  int ret = 0;
+
+  __pthread_spin_lock (&cond->__lock);
+  if (cond->__queue)
+    ret = EBUSY;
+  __pthread_spin_unlock (&cond->__lock);
+
+  return ret;
 }
 
 strong_alias (__pthread_cond_destroy, pthread_cond_destroy);