about summary refs log tree commit diff
path: root/src/thread/pthread_create.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2011-04-01 22:15:03 -0400
committerRich Felker <dalias@aerifal.cx>2011-04-01 22:15:03 -0400
commit4ae5e811f8d291a0df1418e1aae583161c142952 (patch)
tree3c206cb660f4d48ccbe6dc4aaeacc31d1fd988ec /src/thread/pthread_create.c
parent6c16d3e98ab2e466bb12ded12dfad1f8f272b1f8 (diff)
downloadmusl-4ae5e811f8d291a0df1418e1aae583161c142952.tar.gz
musl-4ae5e811f8d291a0df1418e1aae583161c142952.tar.xz
musl-4ae5e811f8d291a0df1418e1aae583161c142952.zip
simplify setting result on thread cancellation
Diffstat (limited to 'src/thread/pthread_create.c')
-rw-r--r--src/thread/pthread_create.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/thread/pthread_create.c b/src/thread/pthread_create.c
index 7cd57d8e..d2344f15 100644
--- a/src/thread/pthread_create.c
+++ b/src/thread/pthread_create.c
@@ -13,7 +13,6 @@ void __pthread_unwind_next(struct __ptcb *cb)
 	if (cb->__next) longjmp((void *)cb->__next->__jb, 1);
 
 	self = pthread_self();
-	if (self->cancel) self->result = PTHREAD_CANCELED;
 
 	LOCK(&self->exitlock);
 
@@ -226,6 +225,7 @@ int pthread_create(pthread_t *res, const pthread_attr_t *attr, void *(*entry)(vo
 	new->detached = attr->_a_detach;
 	new->attr = *attr;
 	new->unblock_cancel = self->cancel;
+	new->result = PTHREAD_CANCELED;
 	memcpy(new->tlsdesc, self->tlsdesc, sizeof new->tlsdesc);
 	new->tlsdesc[1] = (uintptr_t)new;
 	stack = (void *)((uintptr_t)new-1 & ~(uintptr_t)15);