diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2022-01-22 00:12:05 +0000 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2022-01-22 02:17:19 +0100 |
commit | 8c86ba446367fd676457e51eb44d7af2e5d9a392 (patch) | |
tree | 110b0549f3a5708a1b27714d752fa1551e465f70 /htl/pt-create.c | |
parent | e22a4557eb39d7cba9a74d70f4582c13f1a7a83a (diff) | |
download | glibc-8c86ba446367fd676457e51eb44d7af2e5d9a392.tar.gz glibc-8c86ba446367fd676457e51eb44d7af2e5d9a392.tar.xz glibc-8c86ba446367fd676457e51eb44d7af2e5d9a392.zip |
htl: Fix cleaning the reply port
If any RPC fails, the reply port will already be deallocated. __pthread_thread_terminate thus has to defer taking its name until the very last __thread_terminate_release which doesn't reply a message. But then we have to read from the pthread structure. This introduces __pthread_dealloc_finish() which does the recording of the thread termination, so the slot can be reused really only just before the __thread_terminate_release call. Only the real thread can set it, so let's decouple this from the pthread_state by just removing the PTHREAD_TERMINATED state and add a terminated field.
Diffstat (limited to 'htl/pt-create.c')
-rw-r--r-- | htl/pt-create.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/htl/pt-create.c b/htl/pt-create.c index f8a1d21147..ce52ed9f52 100644 --- a/htl/pt-create.c +++ b/htl/pt-create.c @@ -256,7 +256,10 @@ __pthread_create_internal (struct __pthread **thread, failed_starting: /* If joinable, a reference was added for the caller. */ if (pthread->state == PTHREAD_JOINABLE) - __pthread_dealloc (pthread); + { + __pthread_dealloc (pthread); + __pthread_dealloc_finish (pthread); + } __pthread_setid (pthread->thread, NULL); atomic_decrement (&__pthread_total); @@ -278,6 +281,7 @@ failed_thread_alloc: / __vm_page_size) * __vm_page_size + stacksize); failed_stack_alloc: __pthread_dealloc (pthread); + __pthread_dealloc_finish (pthread); failed: return err; } |