diff options
author | Richard Braun <rbraun@sceen.net> | 2014-01-22 01:03:00 +0100 |
---|---|---|
committer | Richard Braun <rbraun@sceen.net> | 2014-01-22 01:03:00 +0100 |
commit | 014966443ac044ca9d53b6bcec6678b9360cba78 (patch) | |
tree | ee013da78c6c898b94e0e97759c54e051459c8fe /pthread/pt-exit.c | |
parent | 9329c3c49fe5f4cde9a84edd5b9b8f26ce38b76e (diff) |
Fix thread destruction
Releasing a thread reference uses a mutex, which means the kernel
resources used for synchronization must be available until late during
the destruction process. For simplicity, merge __pthread_thread_dealloc
into __pthread_thread_terminate.
* Makefile (libpthread-routines): Remove pt-thread-dealloc.
* pthread/pt-create.c (__pthread_create_internal): Remove call to
__pthread_thread_dealloc.
* pthread/pt-exit.c (__pthread_exit): Likewise.
* pthread/pt-internal.h (__pthread_thread_dealloc): Remove declaration.
(__pthread_thread_terminate): Update description.
* sysdeps/mach/pt-thread-dealloc.c: Remove file.
* sysdeps/mach/pt-thread-terminate.c (__pthread_thread_terminate):
Destroy the wake up port.
Diffstat (limited to 'pthread/pt-exit.c')
-rw-r--r-- | pthread/pt-exit.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/pthread/pt-exit.c b/pthread/pt-exit.c index ea61732..6d827db 100644 --- a/pthread/pt-exit.c +++ b/pthread/pt-exit.c @@ -98,15 +98,11 @@ __pthread_exit (void *status) /* Destroy any signal state. */ __pthread_sigstate_destroy (self); - /* Kernel resources may be used to implement synchronization objects, - release them late. */ - __pthread_thread_dealloc (self); - /* Self terminating requires TLS, so defer the release of the TCB until the thread structure is reused. */ - /* Terminate the kernel thread, release the stack and drop the - self reference. */ + /* Release kernel resources, including the kernel thread and the stack, + and drop the self reference. */ __pthread_thread_terminate (self); /* NOTREACHED */ |