set a thread's scheduling priority
cc [options] -Kthread file
int thr_setprio(thread_t tid, int prio);
thr_setprio sets tid's scheduling priority to be prio.
thr_setscheduler can also be used to set the priority
of a thread,
but thr_setprio is a shorthand for use when only the priority,
not the scheduling class, needs to be changed.
For bound threads, the priority set with thr_setprio
is passed to the system scheduler;
it is not maintained by the Threads Library.
For multiplexed threads, the priority set with thr_setprio
is used by the Threads Library in scheduling multiplexed threads
to run on LWPs.
The priorities for multiplexed threads remain fixed
(unless explicitly changed with thr_setscheduler or thr_setprio),
and the Threads Library assigns higher priority threads
to LWPs before lower priority threads.
target thread ID
priority value for tid
Priority range for multiplexed threads
In this implementation,
the priority range for the SCHED_TS policy for multiplexed threads
is from zero to MAXINT-1.
However, for better performance, we recommend using a maximum
priority of 126 or lower.
The default priority for multiplexed threads is 63.
In all scheduling policies supported by this implementation,
numerically higher values represent higher priorities.
Priority range for bound threads
Bound threads running under any scheduling policy
are subject to the priority ranges
set by the system.
to find what
scheduling priorities are available on your system.
No privileges or special permissions are required to use thr_setprio
to set the priority of a multiplexed thread.
The following rules apply to changing the priority
of bound threads:
You can always lower the priority of any bound thread.
You can always raise the priority of bound threads
in the SCHED_FIFO and SCHED_RR classes.
You must have privilege to raise the priority of a bound thread
in the SCHED_TS class.
The required privileges might vary across installations.
thr_setprio returns zero for success
and an error number for failure.
If any of the following error conditions is detected,
thr_setprio fails and returns the corresponding value:
The value of prio is invalid for tid's current scheduling policy.
The caller does not have appropriate privilege
to set the priority of tid.
No thread with identifier tid can be found in the process.
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 - 01 June 2005