pthread_attr_setsched(3-thr) pthread_attr_setsched(3-thr)
NAME
pthreadattrsetsched - changes the scheduling policy attribute of
thread creation
SYNOPSIS
#include <pthread.h>
int pthreadattrsetsched(
pthreadattrt *attr,
int scheduler);
PARAMETERS
attr The thread attributes object modified.
scheduler The new value for the scheduling policy attribute. Valid
values are as follows:
SCHEDFIFO
(First In, First Out) The highest-priority thread
runs until it blocks. If there is more than one
thread with the same priority, and that priority is
the highest among other threads, the first thread to
begin running continues until it blocks.
SCHEDRR
(Round Robin) The highest-priority thread runs until
it blocks; however, threads of equal priority, if
that priority is the highest among other threads, are
timesliced. Timeslicing is a process in which threads
alternate making use of available processors.
SCHEDOTHER
(Default) All threads are timesliced. SCHEDOTHER
ensures that all threads, regardless of priority,
receive some scheduling so that no thread is com-
pletely denied execution time. (However, SCHEDOTHER
threads can be denied execution time by SCHEDFIFO or
SCHEDRR threads.)
SCHEDFGNP
(Foreground) Same as SCHEDOTHER. Threads are
timesliced and priorities can be modified dynamically
by the scheduler to ensure fairness.
SCHEDBGNP
(Background) Ensures that all threads, regardless of
priority, receive some scheduling. However,
SCHEDBGNP can be denied execution by SCHEDFIFO or
SCHEDRR threads.
Page 1 Reliant UNIX 5.44 Printed 11/98
pthread_attr_setsched(3-thr) pthread_attr_setsched(3-thr)
DESCRIPTION
The pthreadattrsetsched() routine sets the scheduling policy of a
thread that is created by using the attributes object specified by the
attr parameter. The default value of the scheduling attribute is
SCHEDOTHER.
RETURN VALUES
If the function fails, errno may be set to one of the following
values:
EINVAL The value specified by attr is invalid.
EINVAL The value specified by scheduler is invalid.
EPERM The caller does not have the appropriate privileges to set
the scheduling policy attribute in the specified threads
attribute object.
SEE ALSO
pthreadattrcreate(3-thr), pthreadattrgetsched(3-thr),
pthreadattrsetinheritsched(3-thr), pthreadcreate(3-thr).
Page 2 Reliant UNIX 5.44 Printed 11/98