HP-UX Reference (11i v2 04/09) - 3 Library Functions N-Z (vol 7)
p
pthread_getschedparam(3T) pthread_getschedparam(3T)
(Pthread Library)
NAME
pthread_getschedparam(), pthread_setschedparam() - get or set the scheduling policy and associated
parameters
SYNOPSIS
#include <pthread.h>
int pthread_getschedparam(
pthread_t thread,
int *policy,
struct sched_param *param
);
int pthread_setschedparam(
pthread_t thread,
int policy,
const struct sched_param *param
);
PARAMETERS
thread The thread whose scheduling policy and associated parameters are to be set/retrieved.
policy This parameter either points to the memory location where the scheduling policy of
thread is returned (get function) or it specifies the new value of the scheduling policy for
thread (set function).
param This parameter either points to the memory location where the scheduling parameters of
thread are returned (get function) or it specifies the new scheduling parameters for
thread (set function).
DESCRIPTION
These functions allow the scheduling policy and associated parameters of threads within a multithreaded
process to be retrieved and changed. The legal values for the scheduling policy and associated scheduling
parameters are defined in
<sched.h>.
pthread_setschedparam()
changes the scheduling policy and associated scheduling parameters for
thread to the policy and the associated parameters provided in policy and param, respectively. On HP-
UX, appropriate privileges are required to change the scheduling parameters of a thread. The calling pro-
cess must have appropriate privileges or be a member of a group having
PRIV_RTSCHED access to suc-
cessfully call pthread_setschedparam()
.
The
pthread_getschedparam()
function retrieves the scheduling policy and associated parameters
for thread and stores those values in policy and param, respectively. The values returned represent the
actual scheduling values, not any temporary values that may be in effect due to priority inheritance or
priority ceiling features.
RETURN VALUE
Upon successful completion,
pthread_setschedparam() and pthread_getschedparam()
return zero. Otherwise, an error number is returned to indicate the error (the errno variable is not set).
ERRORS
If any of the following occur, the
pthread_getschedparam() and pthread_setschedparam()
functions return the corresponding error number:
[ENOSYS]
_POSIX_THREAD_PRIORITY_SCHEDULING
is not defined and these functions
are not supported.
For each of the following conditions, if the condition is detected, the
pthread_setschedparam()
function returns the corresponding error number:
[EINVAL] policy or one of the scheduling parameters in param is invalid.
[ENOTSUP] Either the policy or scheduling parameters contain an unsupported value.
[EPERM] The caller does not have permission to set either the scheduling policy specified in
policy or the scheduling parameters specified in param for thread.
[ESRCH] No thread could be found corresponding to thread.
HP-UX 11i Version 2: September 2004 − 1 − Hewlett-Packard Company Section 3−−787