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