pthread_setprio(3-thr) pthread_setprio(3-thr)
NAME
pthreadsetprio - changes the current priority of a thread
SYNOPSIS
#include <pthread.h>
int pthreadsetprio(
pthreadt thread,
int priority);
PARAMETERS
thread Thread whose priority is changed.
priority New priority value of the thread specified in thread. The
priority value depends on scheduling policy. Valid values
fall within one of the following ranges:
PRIOTHERMIN <= priority <= PRIOTHERMAX
PRIFIFOMIN <= priority <= PRIFIFOMAX
PRIRRMIN <= priority <= PRIRRMAX
PRIFGMINNP <= priority <= PRIFGMAXNP
PRIBGMINNP <= priority <= PRIBGMAXNP
If you create a new thread without specifying a threads attributes
object that contains a changed priority attribute, the default prior-
ity of the newly created thread is the midpoint between PRIOTHERMIN
and PRIOTHERMAX (the midpoint between the minimum and the maximum
for the SCHEDOTHER policy).
When you call this routine to specify a minimum or maximum priority,
use the appropriate symbol; for example, PRIFIFOMIN or PRIFIFOMAX.
To specify a value between the minimum and maximum, use an appropriate
arithmetic expression. For example, to specify a priority midway
between the minimum and maximum for the Round Robin scheduling policy,
specify the following concept using your programming language's syn-
tax:
prirrmid = (PRIRRMIN + PRIRRMAX + 1)/2
If your expression results in a value outside the range of minimum to
maximum, an error results when you use it.
DESCRIPTION
The pthreadsetprio() routine changes the current priority of a
thread. A thread can change its own priority using the identifier
returned by pthreadself().
Page 1 Reliant UNIX 5.44 Printed 11/98
pthread_setprio(3-thr) pthread_setprio(3-thr)
Changing the priority of a thread can cause it to start executing or
be preempted by another thread. The effect of setting different prior-
ity values depends on the scheduling priority assigned to the thread.
The initial scheduling priority is set by calling the
pthreadattrsetprio() routine.
Note that pthreadattrsetprio() sets the priority attribute that is
used to establish the priority of a new thread when it is created.
However, pthreadsetprio() changes the priority of an existing thread.
RETURN VALUES
If successful, this routine returns the previous priority. If the
function fails, errno may be set to one of the following values:
EINVAL The value specified by thread is invalid.
ENOTSUP An attempt is made to set the priority to an unsupported
value.
ESRCH The value specified by thread does not refer to an existing
thread.
EPERM The caller does not have the appropriate privileges to set
the priority of the specified thread.
SEE ALSO
pthreadattrsetprio(3-thr), pthreadattrsetsched(3-thr),
pthreadcreate(3-thr), pthreadself(3-thr),
pthreadsetscheduler(3-thr).
Page 2 Reliant UNIX 5.44 Printed 11/98