diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2020-02-09 19:43:43 +0000 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2020-02-09 19:43:46 +0000 |
commit | 52b6cdb4e32dc9a32a81c68974f34db04db47c82 (patch) | |
tree | f959488d04945f944e2a2cb7a411d2c0228a8016 /sysdeps/htl | |
parent | d8f1f2d9ab2144b589fdac3e381cd86e71871e43 (diff) | |
download | glibc-52b6cdb4e32dc9a32a81c68974f34db04db47c82.tar glibc-52b6cdb4e32dc9a32a81c68974f34db04db47c82.tar.gz glibc-52b6cdb4e32dc9a32a81c68974f34db04db47c82.tar.bz2 glibc-52b6cdb4e32dc9a32a81c68974f34db04db47c82.zip |
htl: support cancellation during pthread_once
Diffstat (limited to 'sysdeps/htl')
-rw-r--r-- | sysdeps/htl/pt-once.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/sysdeps/htl/pt-once.c b/sysdeps/htl/pt-once.c index 0581f7bd6c..7f86e28006 100644 --- a/sysdeps/htl/pt-once.c +++ b/sysdeps/htl/pt-once.c @@ -21,6 +21,13 @@ #include <pt-internal.h> +static void +clear_once_control (void *arg) +{ + pthread_once_t *once_control = arg; + __pthread_spin_unlock (&once_control->__lock); +} + int __pthread_once (pthread_once_t *once_control, void (*init_routine) (void)) { @@ -33,7 +40,10 @@ __pthread_once (pthread_once_t *once_control, void (*init_routine) (void)) if (once_control->__run == 0) { + pthread_cleanup_push (clear_once_control, once_control); init_routine (); + pthread_cleanup_pop (0); + atomic_full_barrier (); once_control->__run = 1; } |