pthread_attr_setprio(3-thr) pthread_attr_setprio(3-thr)
NAME
pthreadattrsetprio - changes the scheduling priority attribute of
thread creation
SYNOPSIS
#include <pthread.h>
int pthreadattrsetprio(
pthreadattrt *attr,
int priority);
PARAMETERS
attr Thread attributes object modified.
priority New value for the priority attribute. The priority attribute
depends on scheduling policy. Valid values fall within one
of the following ranges:
PRIOTHERMIN <= priority <= PRIOTHERMAX
(use with the SCHEDOTHER policy)
PRIFIFOMIN <= priority <= PRIFIFOMAX
(use with the SCHEDFIFO policy)
PRIRRMIN <= priority <= PRIRRMAX
(use with the SCHEDRR policy)
PRIFGMINNP <= priority <= PRIFGMAXNP
(use with the SCHEDFGNP policy)
PRIBGMINNP <= priority <= PRIBGMAXNP
(use with the SCHEDBGNP policy)
The default priority is the midpoint between PRIOTHERMIN and
PRIOTHERMAX. 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 attempt to use it.
Page 1 Reliant UNIX 5.44 Printed 11/98
pthread_attr_setprio(3-thr) pthread_attr_setprio(3-thr)
DESCRIPTION
The pthreadattrsetprio() routine sets the execution priority of
threads that are created using the attributes object specified by the
attr parameter.
By default, a created thread inherits the priority of the thread cal-
ling pthreadcreate(). To specify a priority using this routine,
scheduling inheritance must be disabled at the time the thread is
created. Before calling this routine and pthreadcreate(), call
pthreadattrsetinheritsched() and specify the value
PTHREADDEFAULTSCHED for the inherit parameter.
An application specifies priority only to express the urgency of exe-
cuting the thread relative to other threads. Priority is not used to
control mutual exclusion when accessing shared data.
RETURN VALUES
If the function fails, errno may be set to one of the following
values:
EINVAL The value specified by attr is invalid.
ERANGE One or more parameters supplied have an invalid value.
SEE ALSO
pthreadattrcreate(3-thr), pthreadattrgetprio(3-thr),
pthreadattrsetinheritsched(3-thr), pthreadcreate(3-thr).
Page 2 Reliant UNIX 5.44 Printed 11/98