/* Set detach state attribute in thread attributes object. 
See IEEE 1003.1  */
int pthread_attr_setdetachstate(pthread_attr_t *_attr, int detachstate)
/* Set detach state attribute in thread attributes object. 
See IEEE 1003.1  */
int pthread_attr_setdetachstate(pthread_attr_t *_attr, int detachstate)
{
	struct posix_thread_attr *attr = (struct posix_thread_attr *)_attr;
	if (!__attr_is_initialized(attr) || ((detachstate != PTHREAD_CREATE_DETACHED) &&
					     (detachstate != PTHREAD_CREATE_JOINABLE))) {
		return EINVAL;
	}
	attr->detachstate = detachstate;
	return 0;
}