Changes the current scheduling policy and scheduling parameters of a thread.
pthread_setschedparam( thread, policy, param );
Argument Data Type Accessthread opaque pthread_t read policy integer read param struct sched_param read
#includeint pthread_setschedparam ( pthread_t thread, int policy, const struct sched_param *param);
SCHED_BG_NP SCHED_FG_NP SCHED_FIFO SCHED_OTHER SCHED_RR
See Section 2.2.3.2 for a description of the scheduling policies.
sched_priority
field of
struct sched_param
depend on the chosen policy and
fall within one of the following ranges.
Low HighPRI_FIFO_MIN PRI_FIFO_MAX PRI_RR_MIN PRI_RR_MAX PRI_OTHER_MIN PRI_OTHER_MAX PRI_FG_MIN_NP PRI_FG_MAX_NP PRI_BG_MIN_NP PRI_BG_MAX_NP
Calculate the priority using the appropriate symbols such as PRI_FIFO_MIN or PRI_FIFO_MAX. Avoid using numeric constants as priorities. (Section 2.7 describes how to specify priorities between the minimum and maximum values.)
All currently implemented DECthreads scheduling policies have one scheduling parameter called sched_priority. You must specify an appropriate sched_priority parameter for the policy you choose.
Changing the scheduling policy or priority, or both, of a thread can cause it to start executing or to be preempted by another thread. A thread changes its own scheduling policy and priority by using the handle returned by pthread_self.
This routine differs from pthread_attr_setschedpolicy and pthread_attr_setschedparam, in that those routines set the scheduling policy and parameter attributes that are used to establish the priority and scheduling policy of a new thread when it is created. This routine, however, changes the scheduling policy and parameters of an existing thread.
Return Description0 Successful completion. [EINVAL] The value specified by policy or param is invalid. [ENOTSUP] An attempt is made to set the scheduling policy or a parameter to an unsupported value. [EPERM] The caller does not have the appropriate privileges to set the scheduling policy or parameters of the specified thread. [ESRCH] The value specified by thread does not refer to an existing thread.
pthread_attr_getschedparam pthread_attr_setschedpolicy pthread_create pthread_self sched_yield