pthread_attr_getdetachstate Subroutine



Purpose

Returns the value of the detachstate attribute of a thread attributes
object.

Library

Threads Library (libpthreads.a)

Syntax

#include 

int pthread_attr_getdetachstate (attr, detachstate)
const pthread_attr_t *attr;
int *detachstate;

Description

The pthread_attr_getdetachstate subroutine returns the value of the
detachstate attribute of the thread attributes object attr. This attribute
specifies the detached state of the thread created with this attributes
object. It may have one of the following values:

PTHREAD_CREATE_DETACHED	Specifies that the thread will be created
in detached state. This is the default value.

PTHREAD_CREATE_UNDETACHED	Specifies that the thread will be created
in undetached state.

Note:	The pthread.h header file must be the first included file of
each source file using the threads library.

Parameters

attr	Specifies the thread attributes object.

detachstate	Points to where the detachstate attribute value will be
stored.

Return Values

Upon successful completion, the value of the detached state attribute
is returned via the detachstate parameter, and 0 is returned. Otherwise,
an error code is returned.

Error Codes

The pthread_attr_getdetachstate subroutine is unsuccessful if the
following is true:

EINVAL	The attr parameter is not valid.

Implementation Specifics

This subroutine is part of the Base Operating System (BOS) Runtime.

Related Information

The pthread_attr_setdetachstate subroutine, pthread_attr_init subroutine.

Creating Threads.

Threads Library Quick Reference.