use weak symbols for the POSIX functions that will be used by C threads
[oweals/musl.git] / src / thread / pthread_detach.c
1 #include "pthread_impl.h"
2
3 int __pthread_join(pthread_t, void **);
4
5 int __pthread_detach(pthread_t t)
6 {
7         /* Cannot detach a thread that's already exiting */
8         if (a_swap(t->exitlock, 1))
9                 return __pthread_join(t, 0);
10         t->detached = 2;
11         __unlock(t->exitlock);
12         return 0;
13 }
14
15 weak_alias(__pthread_detach, pthread_detach);