Standard C Library Functions pthreadattrgetdetachstate(3C)
NAME
pthreadattrgetdetachstate, pthreadattrsetdetachstate -
get or set detachstate attribute
SYNOPSIS
cc -mt [ flag... ] file... -lpthread [ library... ]
#include
int pthreadattrsetdetachstate(pthreadattrt *attr,
int detachstate);
int pthreadattrgetdetachstate(const pthreadattrt *attr,
int *detachstate);
DESCRIPTION
The detachstate attribute controls whether the thread is
created in a detached state. If the thread is created
detached, then use of the ID of the newly created thread by
the pthreaddetach() or pthreadjoin() function is an error.
The pthreadattrsetdetachstate() and
pthreadattrgetdetachstate(), respectively, set and get the
detachstate attribute in the attr object.
The detachstate can be set to either
PTHREADCREATEDETACHED or PTHREADCREATEJOINABLE. A value
of PTHREADCREATEDETACHED causes all threads created with
attr to be in the detached state, whereas using a value of
PTHREADCREATEJOINABLE causes all threads created with attr
to be in the joinable state. The default value of the
detachstate attribute is PTHREADCREATEJOINABLE.
RETURN VALUES
Upon successful completion, pthreadattrsetdetachstate()
and pthreadattrgetdetachstate() return a value of 0. Oth-
erwise, an error number is returned to indicate the error.
The pthreadattrgetdetachstate() function stores the value
of the detachstate attribute in detachstate if successful.
ERORS
The pthreadattrsetdetachstate() or
pthreadattrgetdetachstate() functions may fail if:
EINVAL attr or detachstate is invalid.
SunOS 5.11 Last change: 23 Mar 2005 1
Standard C Library Functions pthreadattrgetdetachstate(3C)
ATRIBUTES
See attributes(5) for descriptions of the following attri-
butes:
ATRIBUTE TYPE ATRIBUTE VALUE
Interface Stability Standard
MT-Level MT-Safe
SEE ALSO
pthreadattrinit(3C), pthreadattrsetstackaddr(3C),
pthreadattrsetstacksize(3C), pthreadcreate(3C), attri-
butes(5), standards(5)
SunOS 5.11 Last change: 23 Mar 2005 2
|