HP-UX Reference (11i v2 07/12) - 3 Library Functions N-Z (vol 7)

p
pthread_attr_getdetachstate(3T) pthread_attr_getdetachstate(3T)
(Pthread Library)
pthread_attr_getschedparam()
- get the schedparam attributes.
pthread_attr_setscope()
- set the contentionscope attribute.
pthread_attr_getscope()
- get the contentionscope attribute.
pthread_attr_setprocessor_np()
- set the processor and binding_type attributes.
pthread_attr_getprocessor_np()
- get the processor and binding_type attributes.
The attributes object attr must have previously been initialized with the function
pthread_attr_init()
before these functions are called.
ATTRIBUTE: detachstate
The legal values for the detachstate attribute are:
PTHREAD_CREATE_DETACHED
This option causes all threads created with attr to be in the detached state. The resources asso-
ciated with threads having this state are reclaimed automatically by the system when the
threads terminate. Calling the
pthread_detach()
or pthread_join()
function for
threads created with this attribute results in an error.
PTHREAD_CREATE_JOINABLE
This option causes all threads created with attr to be in the joinable state. The resources associ-
ated with threads having this state are not reclaimed when the threads terminate. An applica-
tion must call the pthread_detach()
or pthread_join() functions for threads created
with this attribute to reclaim the system resources.
The default value of detachstate is
PTHREAD_CREATE_JOINABLE
.
pthread_attr_setdetachstate()
is used to set the detachstate attribute in the initialized attri-
butes object attr. The new value of the detachstate attribute is passed to this function in the detachstate
parameter.
pthread_attr_getdetachstate()
retrieves the value of the detachstate attribute from the thread
attributes object attr. This value is returned in the detachstate parameter.
ATTRIBUTE: stacksize
The legal values for the stacksize attribute are:
PTHREAD_STACK_MIN
This option specifies that the size of the user stack for threads created with this attributes object
will be of default stack size. This value is the minimum stack size (in bytes) required for a
thread. This minimum value may not be acceptable for all threads.
stacksize
This defines the size (in bytes) of the user stack for threads created with this attributes object.
This value must be greater than or equal to the minimum stack size PTHREAD_STACK_MIN
.
POSIX.1c does not define a default value. On HP-UX released on PA-RISC platforms, the default value of
the stacksize attribute is 64K, and 256K in HP-UX released on Itanium(R)-based platforms. On Itanium-
based systems, stack is divided into memory stack and register stack and division is done based on the
implementation.
pthread_attr_setstacksize() is used to set the stacksize attribute in the initialized attributes
object attr. The new value of the stacksize attribute is passed to this function in the stacksize parameter.
While modifying the stacksize attribute on Itanium-based platform, user must keep account of memory
stack as well as register stack requirement.
pthread_attr_getstacksize() retrieves the value of the stacksize attribute from the thread attri-
butes object attr. This value is returned in the stacksize parameter.
ATTRIBUTE: rsestacksize
The legal values for the rsestacksize are:
rsestacksize
This defines the size (in bytes) of the register stack for the threads created with the attributes
object.
pthread_attr_setrsestacksize_np() is used to set the register stack size for a thread and
pthread_default_rsestacksize_np() to set the default register stack size. If either of the set register stack
size APIs is called , the register stack portion of the stack space will be that large instead of
188 Hewlett-Packard Company 3 HP-UX 11i Version 2: December 2007 Update