Sets the detached state of a thread attribute object.
#include <pthread.h> int pthread_attr_setdetachstate ( pthread_attr_t *attr, int detachstate);
(IN) Points to the attribute structure.
(IN) Specifies the detached state with one of the following flags:
If successful, returns zero; otherwise returns a nonzero error code:
The pthread_attr_init function initializes the detached state attribute to PTHREAD_CREATE_JOINABLE.
After the thread is created, a joinable thread can be changed to a detached thread, but a detached thread cannot be modified to become a joinable thread.