htl: Make pthread_cond_destroy wait for threads to be woken
authorSamuel Thibault <samuel.thibault@ens-lyon.org>
Mon, 1 Jun 2020 17:27:48 +0000 (17:27 +0000)
committerSamuel Thibault <samuel.thibault@ens-lyon.org>
Mon, 1 Jun 2020 17:38:31 +0000 (17:38 +0000)
commit8081702460726304af496be52234385094392a6f
tree55606e2a42e6342aaed360c27c17e9675c9c478e
parenta3e589d1f68d43d4c3f67d59497862875c2d5afc
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.
nptl/Makefile
sysdeps/htl/bits/types/struct___pthread_cond.h
sysdeps/htl/pt-cond-destroy.c
sysdeps/htl/pt-cond-timedwait.c
sysdeps/mach/hurd/htl/pt-hurd-cond-timedwait.c
sysdeps/pthread/Makefile
sysdeps/pthread/tst-cond20.c [moved from nptl/tst-cond20.c with 100% similarity]
sysdeps/pthread/tst-cond21.c [moved from nptl/tst-cond21.c with 100% similarity]