The attribute parameters for the
pthread_attr_getdetachstate() and
pthread_attr_setdetachstate() functions are mutually exclusive and must be one of:
PTHREAD_CREATE_JOINABLE
The threads must explicitly be waited for using the
pthread_join(3) function once they exit for their status to be received and their resources to be freed. This is the default.
PTHREAD_CREATE_DETACHED
The thread's resources will automatically be freed once the thread exits, and the thread will not be joined.
If the thread is created as detached, it is an error to use the thread ID with
pthread_detach(3) or
pthread_join(3).