Multithreaded Programming Guide

Get Detach State


Use pthread_attr_getdetachstate(3T) to retrieve the thread create state, which can be either detached or joined.


int	pthread_attr_getdetachstate(const pthread_attr_t *tattr,
    int *detachstate;
#include <pthread.h>

pthread_attr_t tattr;
int detachstate;
int ret;

/* get detachstate of thread */
ret = pthread_attr_getdetachstate (&tattr, &detachstate);

Return Values

pthread_attr_getdetachstate() returns zero after completing successfully. Any other returned value indicates that an error occurred. If the following condition occurs, the function fails and returns the corresponding value.


Indicates that the value of detachstate is NULL or tattr is invalid.