Standard C Library Functions pthreadattrinit(3C)
NAME
pthreadattrinit, pthreadattrdestroy - initialize or des-
troy threads attribute object
SYNOPSIS
cc -mt [ flag... ] file... -lpthread [ library... ]
#include
int pthreadattrinit(pthreadattrt *attr);
int pthreadattrdestroy(pthreadattrt *attr);
DESCRIPTION
The function pthreadattrinit() initializes a thread attri-
butes object attr with the default value for all of the
individual attributes used by a given implementation.
The resulting attribute object (possibly modified by setting
individual attribute values), when used by pthreadcreate(),
defines the attributes of the thread created. A single
attributes object can be used in multiple simultaneous calls
to pthreadcreate().
The pthreadattrinit() function initializes a thread attri-
butes object ( attr) with the default value for each attri-
bute as follows:
Attribute Default Value Meaning of Default
contentionscope PTHREADSCOPEPROCES resource competition within process
detachstate PTHREADCREATEJOINABLE joinable by other threads
stackaddr NUL stack allocated by system
stacksize 0 1 or 2 megabyte
priority 0 priority of the thread
policy SCHEDOTHER traditional time-sharing policy
inheritsched PTHREADINHERITSCHED scheduling policy and parameters
are inherited from the creating
thread
guardsize PAGESIZE size of guard area for a thread's
created stack
The pthreadattrdestroy() function destroys a thread attri-
butes object ( attr), which cannot be reused until it is
reinitialized. An implementation may cause
SunOS 5.11 Last change: 1 Apr 2008 1
Standard C Library Functions pthreadattrinit(3C)
pthreadattrdestroy() to set attr to an implementation-
dependent invalid value. The behavior of using the attribute
after it has been destroyed is undefined.
RETURN VALUES
Upon successful completion, pthreadattrinit() and
pthreadattrdestroy() return a value of 0. Otherwise, an
error number is returned to indicate the error.
ERORS
The pthreadattrinit() function will fail if:
ENOMEM Insufficient memory exists to initialize the
thread attributes object.
The pthreadattrdestroy() function may fail if:
EINVAL attr is invalid.
ATRIBUTES
See attributes(5) for descriptions of the following attri-
butes:
ATRIBUTE TYPE ATRIBUTE VALUE
Interface Stability Committed
MT-Level MT-Safe
Standard See standards(5).
SEE ALSO
sysconf(3C), pthreadattrgetdetachstate(3C),
pthreadattrgetguardsize(3C),
pthreadattrgetinheritsched(3C),
pthreadattrgetschedparam(3C),
pthreadattrgetschedpolicy(3C), pthreadattrgetscope(3C),
pthreadattrgetstackaddr(3C),
pthreadattrgetstacksize(3C),
pthreadattrsetdetachstate(3C),
pthreadattrsetguardsize(3C),
pthreadattrsetinheritsched(3C),
pthreadattrsetschedparam(3C),
pthreadattrsetschedpolicy(3C), pthreadattrsetscope(3C),
SunOS 5.11 Last change: 1 Apr 2008 2
Standard C Library Functions pthreadattrinit(3C)
pthreadattrsetstackaddr(3C),
pthreadattrsetstacksize(3C), pthreadcreate(3C), attri-
butes(5), standards(5)
SunOS 5.11 Last change: 1 Apr 2008 3
|