pthread_detach.c 222 B

1234567891011
  1. #include "pthread_impl.h"
  2. int pthread_detach(pthread_t t)
  3. {
  4. /* Cannot detach a thread that's already exiting */
  5. if (a_xchg(&t->exitlock, 1))
  6. return pthread_join(t, 0);
  7. t->detached = 1;
  8. t->exitlock = 0;
  9. return 0;
  10. }