mirror of
https://github.com/fluencelabs/musl
synced 2025-06-26 13:12:03 +00:00
initial check-in, version 0.5.0
This commit is contained in:
11
src/thread/pthread_detach.c
Normal file
11
src/thread/pthread_detach.c
Normal file
@ -0,0 +1,11 @@
|
||||
#include "pthread_impl.h"
|
||||
|
||||
int pthread_detach(pthread_t t)
|
||||
{
|
||||
/* Cannot detach a thread that's already exiting */
|
||||
if (a_xchg(&t->exitlock, 1))
|
||||
return pthread_join(t, 0);
|
||||
t->detached = 1;
|
||||
t->exitlock = 0;
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user