aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/htl/bits
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/htl/bits
parenta3e589d1f68d43d4c3f67d59497862875c2d5afc (diff)
downloadglibc-8081702460726304af496be52234385094392a6f.zip
glibc-8081702460726304af496be52234385094392a6f.tar.gz
glibc-8081702460726304af496be52234385094392a6f.tar.bz2
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/htl/bits')
-rw-r--r--sysdeps/htl/bits/types/struct___pthread_cond.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/sysdeps/htl/bits/types/struct___pthread_cond.h b/sysdeps/htl/bits/types/struct___pthread_cond.h
index 150a37c..c040b17 100644
--- a/sysdeps/htl/bits/types/struct___pthread_cond.h
+++ b/sysdeps/htl/bits/types/struct___pthread_cond.h
@@ -27,12 +27,12 @@ struct __pthread_cond
__pthread_spinlock_t __lock;
struct __pthread *__queue;
struct __pthread_condattr *__attr;
- struct __pthread_condimpl *__impl;
+ unsigned int __wrefs;
void *__data;
};
/* Initializer for a condition variable. */
#define __PTHREAD_COND_INITIALIZER \
- { __PTHREAD_SPIN_LOCK_INITIALIZER, NULL, NULL, NULL, NULL }
+ { __PTHREAD_SPIN_LOCK_INITIALIZER, NULL, NULL, 0, NULL }
#endif /* bits/types/struct___pthread_cond.h */