pthread_detach.c 227 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_swap(t->exitlock, 1))
  6. return pthread_join(t, 0);
  7. t->detached = 2;
  8. __unlock(t->exitlock);
  9. return 0;
  10. }