mirror of https://github.com/mkerrisk/man-pages
93 lines
3.1 KiB
Plaintext
93 lines
3.1 KiB
Plaintext
|
.\" Copyright (c) 2001-2003 The Open Group, All Rights Reserved
|
||
|
.TH "PTHREAD_ATTR_GETDETACHSTATE" P 2003 "IEEE/The Open Group" "POSIX Programmer's Manual"
|
||
|
.\" pthread_attr_getdetachstate
|
||
|
.SH NAME
|
||
|
pthread_attr_getdetachstate, pthread_attr_setdetachstate \- get and
|
||
|
set the detachstate attribute
|
||
|
.SH SYNOPSIS
|
||
|
.LP
|
||
|
\fB#include <pthread.h>
|
||
|
.br
|
||
|
.sp
|
||
|
int pthread_attr_getdetachstate(const pthread_attr_t *\fP\fIattr\fP\fB,
|
||
|
.br
|
||
|
\ \ \ \ \ \ int *\fP\fIdetachstate\fP\fB);
|
||
|
.br
|
||
|
int pthread_attr_setdetachstate(pthread_attr_t *\fP\fIattr\fP\fB,
|
||
|
int\fP \fIdetachstate\fP\fB); \fP
|
||
|
\fB
|
||
|
.br
|
||
|
\fP
|
||
|
.SH DESCRIPTION
|
||
|
.LP
|
||
|
The \fIdetachstate\fP 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 \fIpthread_detach\fP()
|
||
|
or \fIpthread_join\fP() function is an error.
|
||
|
.LP
|
||
|
The \fIpthread_attr_getdetachstate\fP() and \fIpthread_attr_setdetachstate\fP()
|
||
|
functions, respectively, shall get and set the
|
||
|
\fIdetachstate\fP attribute in the \fIattr\fP object.
|
||
|
.LP
|
||
|
For \fIpthread_attr_getdetachstate\fP(), \fIdetachstate\fP shall be
|
||
|
set to either PTHREAD_CREATE_DETACHED or
|
||
|
PTHREAD_CREATE_JOINABLE.
|
||
|
.LP
|
||
|
For \fIpthread_attr_setdetachstate\fP(), the application shall set
|
||
|
\fIdetachstate\fP to either PTHREAD_CREATE_DETACHED or
|
||
|
PTHREAD_CREATE_JOINABLE.
|
||
|
.LP
|
||
|
A value of PTHREAD_CREATE_DETACHED shall cause all threads created
|
||
|
with \fIattr\fP to be in the detached state, whereas using a
|
||
|
value of PTHREAD_CREATE_JOINABLE shall cause all threads created with
|
||
|
\fIattr\fP to be in the joinable state. The default value of
|
||
|
the \fIdetachstate\fP attribute shall be PTHREAD_CREATE_JOINABLE.
|
||
|
.SH RETURN VALUE
|
||
|
.LP
|
||
|
Upon successful completion, \fIpthread_attr_getdetachstate\fP() and
|
||
|
\fIpthread_attr_setdetachstate\fP() shall return a value
|
||
|
of 0; otherwise, an error number shall be returned to indicate the
|
||
|
error.
|
||
|
.LP
|
||
|
The \fIpthread_attr_getdetachstate\fP() function stores the value
|
||
|
of the \fIdetachstate\fP attribute in \fIdetachstate\fP if
|
||
|
successful.
|
||
|
.SH ERRORS
|
||
|
.LP
|
||
|
The \fIpthread_attr_setdetachstate\fP() function shall fail if:
|
||
|
.TP 7
|
||
|
.B EINVAL
|
||
|
The value of \fIdetachstate\fP was not valid
|
||
|
.sp
|
||
|
.LP
|
||
|
These functions shall not return an error code of [EINTR].
|
||
|
.LP
|
||
|
\fIThe following sections are informative.\fP
|
||
|
.SH EXAMPLES
|
||
|
.LP
|
||
|
None.
|
||
|
.SH APPLICATION USAGE
|
||
|
.LP
|
||
|
None.
|
||
|
.SH RATIONALE
|
||
|
.LP
|
||
|
None.
|
||
|
.SH FUTURE DIRECTIONS
|
||
|
.LP
|
||
|
None.
|
||
|
.SH SEE ALSO
|
||
|
.LP
|
||
|
\fIpthread_attr_destroy\fP() , \fIpthread_attr_getstackaddr\fP() ,
|
||
|
\fIpthread_attr_getstacksize\fP() , \fIpthread_create\fP()
|
||
|
, the Base Definitions volume of IEEE\ Std\ 1003.1-2001, \fI<pthread.h>\fP
|
||
|
.SH COPYRIGHT
|
||
|
Portions of this text are reprinted and reproduced in electronic form
|
||
|
from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
|
||
|
-- Portable Operating System Interface (POSIX), The Open Group Base
|
||
|
Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
|
||
|
Electrical and Electronics Engineers, Inc and The Open Group. In the
|
||
|
event of any discrepancy between this version and the original IEEE and
|
||
|
The Open Group Standard, the original IEEE and The Open Group Standard
|
||
|
is the referee document. The original Standard can be obtained online at
|
||
|
http://www.opengroup.org/unix/online.html .
|