diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2020-02-09 17:01:06 +0100 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2020-02-09 17:01:06 +0100 |
commit | 19a64d9f6eda12cd4b802aac470c645d208a1216 (patch) | |
tree | f5d82caae5cdd7131aa9bdf1216c8b37cd55945b /sysdeps/mach | |
parent | 3430ed09d3bef58dbf3fe18d87716236883599d8 (diff) | |
download | glibc-19a64d9f6eda12cd4b802aac470c645d208a1216.zip glibc-19a64d9f6eda12cd4b802aac470c645d208a1216.tar.gz glibc-19a64d9f6eda12cd4b802aac470c645d208a1216.tar.bz2 |
htl: Fix calling pthread_exit in the child of a fork
We need to reset the threads counter, otherwise pthread_exit() would not
call exit(0).
Diffstat (limited to 'sysdeps/mach')
-rw-r--r-- | sysdeps/mach/hurd/htl/pt-sysdep.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/sysdeps/mach/hurd/htl/pt-sysdep.c b/sysdeps/mach/hurd/htl/pt-sysdep.c index e306cc8..32a290c 100644 --- a/sysdeps/mach/hurd/htl/pt-sysdep.c +++ b/sysdeps/mach/hurd/htl/pt-sysdep.c @@ -35,6 +35,13 @@ static void *init_routine (void); want to change it yet. */ void *(*_cthread_init_routine) (void) = &init_routine; +static void +reset_pthread_total (void) +{ + /* Only current thread remains */ + __pthread_total = 1; +} + /* This function is called from the Hurd-specific startup code. It should return a new stack pointer for the main thread. The caller will switch to this new stack before doing anything serious. */ @@ -78,6 +85,8 @@ _init_routine (void *stack) when we return from here) shouldn't be seen as a user thread. */ __pthread_total--; + __pthread_atfork (NULL, NULL, reset_pthread_total); + /* Make MiG code thread aware. */ __mig_init (thread->stackaddr); |