diff options
Diffstat (limited to 'nptl/pthread_create.c')
-rw-r--r-- | nptl/pthread_create.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c index 71a5619..dcca1a5 100644 --- a/nptl/pthread_create.c +++ b/nptl/pthread_create.c @@ -433,8 +433,10 @@ START_THREAD_DEFN if (freesize > PTHREAD_STACK_MIN) __madvise (pd->stackblock, freesize - PTHREAD_STACK_MIN, MADV_DONTNEED); + const bool detached = IS_DETACHED (pd); + /* If the thread is detached free the TCB. */ - if (IS_DETACHED (pd)) + if (detached) /* Free the TCB. */ __free_tcb (pd); else if (__glibc_unlikely (pd->cancelhandling & SETXID_BITMASK)) @@ -457,7 +459,7 @@ START_THREAD_DEFN The exit code is zero since in case all threads exit by calling 'pthread_exit' the exit status must be 0 (zero). */ - __exit_thread (); + __exit_thread (detached); /* NOTREACHED */ } |