Making A Thread Detached To put a thread in the 'detached' state, the "pthread_detach" function, or by initially creating it in a detached state. The "pthread_detach" function accepts a "pthread_t" argument. Here is how a thread can put itself in a detached state: /* first, get the current thread's "handle". */ /* this function "cannot fail". */ pthread_t self = pthread_self(); /* and now put the current thread in detached state. */ if (pthread_detach(self) != 0) { /* handle error... */ }