pthread_attr_setinheritsched(3-thr) pthread_attr_setinheritsched(3-thr)
NAME
pthreadattrsetinheritsched - changes the inherit scheduling attri-
bute
SYNOPSIS
#include <pthread.h>
int pthreadattrsetinheritsched(
pthreadattrt attr,
int inherit);
PARAMETERS
attr Thread attributes object to be modified.
inherit New value for the inherit scheduling attribute. Valid values
are as follows:
PTHREADINHERITSCHED
This is the default value. The created thread inherits
the current priority and scheduling policy of the
thread calling pthreadcreate().
PTHREADDEFAULTSCHED
The created thread starts execution with the priority
and scheduling policy stored in the thread attributes
object.
DESCRIPTION
The pthreadattrsetinheritsched() routine changes the inherit
scheduling attribute of thread creation. The inherit scheduling attri-
bute specifies whether threads created using the specified thread
attributes object inherit the scheduling attributes of the creating
thread, or use the scheduling attributes stored in the thread attri-
butes object that is passed to pthreadcreate().
The first thread in an application that is not created by an explicit
call to pthreadcreate() has a scheduling policy of SCHEDOTHER. (See
the pthreadattrsetprio() and pthreadattrsetsched() routines for
more information on valid priority values and valid scheduling policy
values, respectively.)
Inheriting scheduling attributes (instead of using the scheduling
attributes stored in the attributes object) is useful when a thread is
creating several helper threads - threads that are intended to work
closely with the creating thread to cooperatively solve the same prob-
lem. For example, inherited scheduling attributes ensure that helper
threads created in a sort routine execute with the same priority as
the calling thread.
Page 1 Reliant UNIX 5.44 Printed 11/98
pthread_attr_setinheritsched(3-thr) pthread_attr_setinheritsched(3-thr)
RETURN VALUES
If the function fails, -1 is returned, and errno may be set to one of
the following values:
EINVAL The value specified by attr is invalid.
EINVAL The value specified by inherit is invalid.
SEE ALSO
pthreadattrcreate(3-thr), pthreadattrgetinheritsched(3-thr),
pthreadattrsetprio(3-thr), pthreadattrsetsched(3-thr),
pthreadcreate(3-thr).
Page 2 Reliant UNIX 5.44 Printed 11/98