Index of Section 2 Manual Pages
| Interix / SUA | pthread_setschedparam.2 | Interix / SUA |
pthread_setschedparam(2) pthread_setschedparam(2)
pthread_getschedparam()
NAME
pthread_getschedparam(), pthread_setschedparam() - get or set thread
scheduling settings
SYNOPSIS
#include
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);
DESCRIPTION
The pthread_setschedparam(2) function sets the scheduling policy and
parameters of the thread identified by the thread argument using values
supplied by the policy and param arguments.
The policy argument can be set to any of the following values:
* SCHED_FIFO: Run to completion
* SCHED_RR: Round-robin
* SCHED_OTHER: Use scheduling values set in the sched_param structure
referenced by policy.
The sched_param structure referenced by the param argument is defined in
and contains the following fields:
struct sched_param {
int sched_priority; /* scheduling priority */
int sched_nicelim; /* nice value limit for SCHED_OTHER policy */
int sched_nice; /* nice value for SCHED_OTHER policy */
int sched_pad[6]; /* this is used for padding */
};
NOTE: In this version of Interix, the pthread_setschedparam(2) function
supports only the SCHED_OTHER scheduling policy. Only the sched_priority
field of the sched_param structure is required.
The valid range for the priorities is the range returned by
sched_get_priority_min(2) and sched_get_priority_max(2). The effective
thread priority is equal to the process priority (determined from the
nice(2) value of the process) plus the thread priority that is set or
retrieved by this function.
The pthread_getschedparam(2) function retrieves the current scheduling
policy and parameter settings of the thread identified by the thread
argument and stores these values in the locations referenced by the policy
and param arguments, respectively.
RETURN VALUES
On success, both functions return 0; otherwise, an error code is returned.
ERRORS
The pthread_getschedparam() function can fail for the following reason:
[ESRCH]
The thread argument does not identify an existing thread.
The pthread_setschedparam() function can fail for the following reasons:
[EINVAL]
The policy argument does not refer to a valid sched_param structure or
one of the parameters in the structure is invalid.
[ENOTSUP]
An attempt was made to set the thread policy or parameters to an
unsupported value.
[EPERM]
The caller does not have the required permissions to set the
scheduling policy or parameters of the specified thread.
[ESRCH]
The thread argument does not identify an existing thread
Neither function returns [EINTR]..
SEE ALSO
pthread_attr_getschedparam(2)
pthread_attr_getschedpolicy(2)
pthread_create(2)
pthread_setschedprio(2)
USAGE NOTES
All of these functions are thread safe.
None of these functions are async-signal safe.