From 8081702460726304af496be52234385094392a6f Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Mon, 1 Jun 2020 17:27:48 +0000 Subject: 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. --- sysdeps/pthread/tst-cond21.c | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 sysdeps/pthread/tst-cond21.c (limited to 'sysdeps/pthread/tst-cond21.c') 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 +#define TIMED 1 +#include "tst-cond20.c" -- cgit 1.4.1