about summary refs log tree commit diff
path: root/sysdeps/pthread/tst-cond21.c
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2020-06-01 17:27:48 +0000
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2020-06-01 17:38:31 +0000
commit8081702460726304af496be52234385094392a6f (patch)
tree55606e2a42e6342aaed360c27c17e9675c9c478e /sysdeps/pthread/tst-cond21.c
parenta3e589d1f68d43d4c3f67d59497862875c2d5afc (diff)
downloadglibc-8081702460726304af496be52234385094392a6f.tar.gz
glibc-8081702460726304af496be52234385094392a6f.tar.xz
glibc-8081702460726304af496be52234385094392a6f.zip
htl: Make pthread_cond_destroy wait for threads to be woken
This allows to reuse the storage after calling pthread_cond_destroy.

* sysdeps/htl/bits/types/struct___pthread_cond.h (__pthread_cond):
Replace unused struct __pthread_condimpl *__impl field with unsigned int
__wrefs.
(__PTHREAD_COND_INITIALIZER): Update accordingly.
* sysdeps/htl/pt-cond-timedwait.c (__pthread_cond_timedwait_internal):
Register as waiter in __wrefs field. On unregistering, wake any pending
pthread_cond_destroy.
* sysdeps/htl/pt-cond-destroy.c (__pthread_cond_destroy): Register wake
request in __wrefs.
* nptl/Makefile (tests): Move tst-cond20 tst-cond21 to...
* sysdeps/pthread/Makefile (tests): ... here.
* nptl/tst-cond20.c nptl/tst-cond21.c: Move to...
* sysdeps/pthread/tst-cond20.c sysdeps/pthread/tst-cond21.c: ... here.
Diffstat (limited to 'sysdeps/pthread/tst-cond21.c')
-rw-r--r--sysdeps/pthread/tst-cond21.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sysdeps/pthread/tst-cond21.c b/sysdeps/pthread/tst-cond21.c
new file mode 100644
index 0000000000..89cb771b57
--- /dev/null
+++ b/sysdeps/pthread/tst-cond21.c
@@ -0,0 +1,3 @@
+#include <sys/time.h>
+#define TIMED 1
+#include "tst-cond20.c"