diff options
| author | Mike Makonnen <mtm@FreeBSD.org> | 2003-05-25 22:40:57 +0000 | 
|---|---|---|
| committer | Mike Makonnen <mtm@FreeBSD.org> | 2003-05-25 22:40:57 +0000 | 
| commit | 12c407a42419514164b8f82ef202d73f6f7c9a09 (patch) | |
| tree | 8bc5a970789c8f2762484249a02b9ccd0ccb6ef6 /lib/libthr/thread/thr_create.c | |
| parent | a9a0bbad19f73db3d2cb9b10ba5fce3bb3fbcdec (diff) | |
Notes
Diffstat (limited to 'lib/libthr/thread/thr_create.c')
| -rw-r--r-- | lib/libthr/thread/thr_create.c | 13 | 
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/libthr/thread/thr_create.c b/lib/libthr/thread/thr_create.c index 30334211f1c5..5b0158dedad4 100644 --- a/lib/libthr/thread/thr_create.c +++ b/lib/libthr/thread/thr_create.c @@ -116,7 +116,18 @@ _pthread_create(pthread_t * thread, const pthread_attr_t * attr,  	new_thread->ctx.uc_stack.ss_sp = new_thread->stack;  	new_thread->ctx.uc_stack.ss_size = pattr->stacksize_attr;  	makecontext(&new_thread->ctx, _thread_start, 0); -	new_thread->arch_id = _set_curthread(&new_thread->ctx, new_thread); +	new_thread->arch_id = _set_curthread(&new_thread->ctx, new_thread, &ret); +	if (ret != 0) { +		if (pattr->stackaddr_attr == NULL) { +			/* XXX - We really need to decouple from this lock */ +			DEAD_LIST_LOCK; +			_thread_stack_free(new_thread->stack, +			    pattr->stacksize_attr, pattr->guardsize_attr); +			DEAD_LIST_UNLOCK; +		} +		free(new_thread); +		return (ret); +	}  	/* Copy the thread attributes: */  	memcpy(&new_thread->attr, pattr, sizeof(struct pthread_attr));  | 
