X-Git-Url: http://nsz.repo.hu/git/?p=musl;a=blobdiff_plain;f=src%2Fthread%2Fpthread_detach.c;h=651c38ebe86cc82ce51aca57731da21c48851e73;hp=f0eae3e8eb91e04e1a2e46397a9fa674db02fbf6;hb=HEAD;hpb=0b44a0315b47dd8eced9f3b7f31580cf14bbfc01 diff --git a/src/thread/pthread_detach.c b/src/thread/pthread_detach.c index f0eae3e8..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_xchg(&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; }