X-Git-Url: http://nsz.repo.hu/git/?p=musl;a=blobdiff_plain;f=src%2Fthread%2Fpthread_detach.c;h=651c38ebe86cc82ce51aca57731da21c48851e73;hp=8ef03d514147c12a2408a1ca37e08bf1998751ae;hb=HEAD;hpb=2b71a4d1dfb0487cc2558df646a262ffb8261585 diff --git a/src/thread/pthread_detach.c b/src/thread/pthread_detach.c index 8ef03d51..651c38eb 100644 --- a/src/thread/pthread_detach.c +++ b/src/thread/pthread_detach.c @@ -3,9 +3,9 @@ int pthread_detach(pthread_t t) { /* Cannot detach a thread that's already exiting */ - if (a_swap(&t->exitlock, 1)) + if (a_swap(t->exitlock, 1)) return pthread_join(t, 0); - t->detached = 1; - t->exitlock = 0; + t->detached = 2; + __unlock(t->exitlock); return 0; }