HP-UX Reference (11i v2 04/09) - 3 Library Functions N-Z (vol 7)
p
pthread_attr_getdetachstate(3T) pthread_attr_getdetachstate(3T)
(Pthread Library)
ATTRIBUTE: schedpolicy
The schedpolicy attribute allows threads created with this attributes object to use a specific scheduling
policy. To use this attribute, the inheritsched attribute must be set to
PTHREAD_EXPLICIT_SCHED
.
For a complete list of valid scheduling policies, refer to rtsched (2) and
<sched.h>.
POSIX.1c does not specify a default value for the schedpolicy attribute. On HP-UX, the default value for
system scope threads is
SCHED_TIMESHARE
.
pthread_attr_setschedpolicy()
is used to set the schedpolicy attribute in the initialized attri-
butes object attr . The new value of the schedpolicy attribute is passed to this function in the policy
parameter.
pthread_attr_getschedpolicy()
retrieves the value of the schedpolicy attribute from the thread
attributes object attr . This value is returned in the policy parameter.
ATTRIBUTE: schedparam
The legal values for the schedparam attribute associated with the schedpolicy attribute vary depending
upon the scheduling policy. For the
SCHED_FIFO and SCHED_RR scheduling policies, only the
sched_priority member of the schedparam attribute is required. Legal values for sched_priority can be
obtained through
sched_get_priority_max()
and sched_get_priority_min()
. The
required contents of schedparam for other scheduling policies is undefined. For a complete list of
required and valid scheduling parameters for all scheduling policies, refer to rtsched (2) and
<sched.h>.
pthread_attr_setschedparam()
is used to set the schedparam attribute in the initialized attri-
butes object attr . The new value of the schedparam attribute is passed to this function in the param
parameter.
pthread_attr_getschedparam()
retrieves the value of the schedparam attribute from the thread
attributes object attr . This value is returned in the param parameter.
ATTRIBUTE: contentionscope
The legal values for the contentionscope attribute are:
PTHREAD_SCOPE_SYSTEM
Threads created with this contention scope contend for resources with all other threads in the
system (and within the same scheduling domain). This attribute is generally used to indicate
that the user thread should be bound directly to a kernel-scheduled entity.
PTHREAD_SCOPE_PROCESS
Threads created with this contention scope contend directly with other threads within their
process that were created with this scheduling contention scope. This attribute is generally
used to indicate that the user thread should be unbound (not bound to any particular kernel-
scheduled entity).
The default value of the contentionscope attribute is not defined by POSIX.1c. On HP-UX release 11i v2
September 2004 and forward, the default value of the contentionscope attribute is
PTHREAD_SCOPE_SYSTEM
and this default scope can also be controlled externally by using the options
documented in the pthread_scope_options(5) man page.
pthread_attr_setscope() is used to set the contentionscope attribute in the initialized attributes
object attr . The new value of the contentionscope attribute is passed to this function in the contention-
scope parameter.
pthread_attr_getscope() retrieves the value of the contentionscope attribute from the thread
attributes object attr . This value is returned in the contentionscope parameter.
ATTRIBUTES: processor and binding_type
The legal values for the processor attribute are:
PTHREAD_SPUINHERIT_NP
Threads created with this processor attribute inherit their processor binding attributes from
the creating thread. This is the default value of the processor attribute. Specifying
PTHREAD_LDOMINHERIT_NP or PTHREAD_SPUINHERIT_NP cause both processor binding
and locality domain binding attributes to be inherited. The binding_type attribute is ignored.
PTHREAD_SPUFLOAT_NP
Threads created with this processor attribute are allowed to execute on any processor the sys-
tem chooses. No processor binding is maintained. Specifying PTHREAD_LDOMFLOAT_NP or
PTHREAD_SPUFLOAT_NP cause both processor binding and locality domain binding attri-
butes to be cleared. The thread will be allowed to execute on any processor in the system. The
Section 3−−758 Hewlett-Packard Company − 5 − HP-UX 11i Version 2: September 2004