simplify setting result on thread cancellation
authorRich Felker <dalias@aerifal.cx>
Sat, 2 Apr 2011 02:15:03 +0000 (22:15 -0400)
committerRich Felker <dalias@aerifal.cx>
Sat, 2 Apr 2011 02:15:03 +0000 (22:15 -0400)
src/thread/pthread_create.c

index 7cd57d8..d2344f1 100644 (file)
@@ -13,7 +13,6 @@ void __pthread_unwind_next(struct __ptcb *cb)
        if (cb->__next) longjmp((void *)cb->__next->__jb, 1);
 
        self = pthread_self();
        if (cb->__next) longjmp((void *)cb->__next->__jb, 1);
 
        self = pthread_self();
-       if (self->cancel) self->result = PTHREAD_CANCELED;
 
        LOCK(&self->exitlock);
 
 
        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->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);
        memcpy(new->tlsdesc, self->tlsdesc, sizeof new->tlsdesc);
        new->tlsdesc[1] = (uintptr_t)new;
        stack = (void *)((uintptr_t)new-1 & ~(uintptr_t)15);