From 714413a7694ff534855e9e5904899695eac6c9bb Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Thu, 24 Oct 2013 11:44:52 +0200 Subject: Really use user-provided stack * pthread/pt-create.c (__pthread_create_internal): When the user provides a `stackaddr`, use it instead of allocating a stack. * pthread/pt-detach.c (pthread_detach): Only deallocate the stack when it was allocated by libpthread. * pthread/pt-join.c (pthread_join): Likewise. --- pthread/pt-detach.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'pthread/pt-detach.c') diff --git a/pthread/pt-detach.c b/pthread/pt-detach.c index 1e42c45..4ed8d2c 100644 --- a/pthread/pt-detach.c +++ b/pthread/pt-detach.c @@ -66,9 +66,11 @@ pthread_detach (pthread_t thread) /* Destroy the stack, the kernel resources and the control block. */ - assert (pthread->stack); - __pthread_stack_dealloc (pthread->stackaddr, pthread->stacksize); - pthread->stack = 0; + if (pthread->stack) + { + __pthread_stack_dealloc (pthread->stackaddr, pthread->stacksize); + pthread->stack = 0; + } __pthread_thread_dealloc (pthread); -- cgit v1.2.3