/* This function set detach state attribute in thread attributes object. 
PTHREAD_CREATE_JOINABLE Default value, it causes all threads created with attr to be in the joinable state. */
int pthread_attr_setdetachstate(pthread_attr_t *attr, int state)
/* This function set detach state attribute in thread attributes object. 
PTHREAD_CREATE_JOINABLE Default value, it causes all threads created with attr to be in the joinable state. */
int pthread_attr_setdetachstate(pthread_attr_t *attr, int state)
{
    RT_ASSERT(attr != RT_NULL);
    if (state != PTHREAD_CREATE_JOINABLE && state != PTHREAD_CREATE_DETACHED)
        return EINVAL;
    attr->detachstate = state;
    return 0;
}