From 54e51f1330ed2f31fd5b7a7260478880c54d33b7 Mon Sep 17 00:00:00 2001 From: neal Date: Sat, 16 Aug 2008 09:37:22 +0000 Subject: 2008-08-16 Neal H. Walfield * pthread/pt-alloc.c: Don't include . (__pthread_free_threads): Change to a struct __pthread *. (__pthread_free_threads_lock): New variable. (__pthread_alloc): When looking for a TCB to reuse, iterate over __pthread_free_threads taking the first for which the STATE field is PTHREAD_TERMINATED. When reusing a TCB, first call __pthread_thread_halt on it. * pthread/pt-dealloc.c: Don't include . (__pthread_free_threads): Change to a struct __pthread *. (__pthread_free_threads_lock): New declaration. (__pthread_dealloc): Enqueue PTHREAD on __PTHREAD_FREE_THREADS. Set PTHREAD->STATE to PTHREAD_TERMINATED after everything else. * pthread/pt-join.c (pthread_join): Call __pthread_thread_halt before destroying the thread. When destroying the thread, call __pthread_thread_dealloc on it. * pthread/pt-exit.c (pthread_exit): Call __pthread_dealloc only if the thread is detached and then as the last thing we do before calling __pthread_thread_halt. * pthread/pt-internal.h (__pthread_thread_halt): Remove argument NEED_DEALLOC. Update users. * sysdeps/l4/hurd/pt-thread-halt.c (__pthread_thread_halt): Remove argument need_dealloc. Move the deallocation code from this file... * sysdeps/l4/hurd/pt-thread-dealloc.c: ... to this new file. * sysdeps/l4/hurd/pt-sysdep.h (PTHREAD_SYSDEP_MEMBERS): Add field have_kernel_resources. * sysdeps/l4/hurd/pt-thread-alloc.c (__pthread_thread_alloc): If THREAD->HAVE_KERNEL_RESOURCES is true, just return. After allocating the resources, set THREAD->HAVE_KERNEL_RESOURCES to true. --- libpthread/pthread/pt-create.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libpthread/pthread/pt-create.c') diff --git a/libpthread/pthread/pt-create.c b/libpthread/pthread/pt-create.c index 5bb9f1f..504cacc 100644 --- a/libpthread/pthread/pt-create.c +++ b/libpthread/pthread/pt-create.c @@ -195,7 +195,7 @@ __pthread_create_internal (struct __pthread **thread, __pthread_sigstate_destroy (pthread); failed_setup: __pthread_thread_dealloc (pthread); - __pthread_thread_halt (pthread, 0); + __pthread_thread_halt (pthread); failed_thread_alloc: __pthread_stack_dealloc (pthread->stackaddr, pthread->stacksize); pthread->stack = 0; -- cgit v1.2.3