pthread_getschedattr(3T) DG/UX 5.4R3.00 pthread_getschedattr(3T)
NAME
pthreadgetschedattr, pthreadsetschedattr - get or set thread
scheduling attributes
SYNOPSIS
#include <pthread.h>
int pthreadgetschedattr(pthreadt thread, pthreadattrt *attrs);
int pthreadsetschedattr(pthreadt thread, pthreadattrt *attrs);
where:
thread The target thread's ID
attrs A pointer to a thread attributes object
DESCRIPTION
The pthreadgetschedattr() and pthreadsetschedattr() functions
retrieve and set the scheduling attributes of the thread whose thread
ID is given by thread. For these calls, only the scheduling policy
and priority attributes are manipulated. Other attributes, including
all basic thread attributes and other scheduling attributes, are
neither retrieved nor modified.
The pthreadgetschedattr() function retrieves the scheduling policy
and priority for the thread whose thread ID is given by thread and
stores those values in the attributes object pointed to by attrs.
The pthreadsetschedattr() function sets the scheduling policy and
priority for the thread whose thread ID is given by thread to values
provided in the attributes object pointed to by attrs. These new
attributes apply either locally or globally, depending on the
contention scope of the target thread.
Refer to pthreadsetsched(3T), pthreadprio(3T), and <sched.h> for
detailed descriptions of the scheduling policy and priority
attributes.
The values in the attributes object pointed to by attrs are not
checked for full validity until they are used in calls to
pthreadsetschedattr and other functions such as pthreadcreate().
Hence it is possible that certain combinations of values are either
illegal or not permitted for the caller of these functions.
Typically the user of these functions calls pthreadgetschedattr() to
retrieve the current scheduling policy and priority of the target
thread, modifies one or both of these values in the attributes
object, then calls pthreadsetschedattr() to cause the new values to
take affect for the target thread.
If pthreadsetschedattr() fails, no scheduling attributes are changed
for the target thread.
DIAGNOSTICS
Return Value
If successful, pthreadgetschedattr() and pthreadsetschedattr()
Licensed material--property of copyright holder(s) 1
pthread_getschedattr(3T) DG/UX 5.4R3.00 pthread_getschedattr(3T)
return 0. Otherwise, they return -1 and set errno.
Errors
For each of the following conditions, pthreadgetschedattr() and
pthreadsetschedattr() return -1 and set errno to the corresponding
value:
[ESRCH] The value specified by thread does not refer to a existing
thread.
[EINVAL] An invalid attributes object has been specified. This
occurs when DG/UX has detected that the attributes object
pointed to by attrs has not been initialized by a previous
call to pthreadattrinit() or has been corrupted.
For each of the following conditions, pthreadsetschedattr() returns
-1 and set errno to the corresponding value:
[EINVAL] An invalid combination of scheduling policy and priority
has been specified in the attributes object pointed to by
attrs.
[EPERM] The caller does not have the appropriate privileges to set
either the priority or the scheduling policy of the
specified thread. In DG/UX, this can never occur if the
target thread has local contention scope.
SEE ALSO
pthreadattrsetsched(3T), pthreadattrsetprio(3T),
schedsetparam(2), schedsetscheduler(2), threads(5).
NOTES
Following the get-modify-set paradigm described above is advisable,
as it conforms more easily to the addition of future scheduling
attributes to the standard.
In DG/UX, changing the scheduling policy and priority of a thread
with global contention scope changes these attributes for both the
thread and its dedicated thread group. The two are always kept in
sync for globally scheduled threads.
Licensed material--property of copyright holder(s) 2