PTHREAD_ATTR_SCHEDPOLICY(3) BSD Programmer's ManualPTHREAD_ATTR_SCHEDPOLICY(3)NAME
pthread_attr_getschedpolicy, pthread_attr_setschedpolicy - pthread
scheduling policy attribute objects
SYNOPSIS
#include <pthread.h>
#include <sched.h>
int
pthread_attr_getschedpolicy(pthread_attr_t *attr, int *policy);
int
pthread_attr_setschedpolicy(pthread_attr_t *attr, int policy);
DESCRIPTION
This interface is defined by IEEE Std1003.1c (``POSIX'').
The pthread_attr_getschedpolicy() and pthread_attr_setschedpolicy() func-
tions retrieve and establish the threads scheduling policy attribute in
the attribute object pointed to by attr. The policy should be specified
as one of:
SCHED_FIFO All threads created with the creation attribute attr are
scheduled in pre-emptive, priority order. Rescheduling
can occur if a higher priority thread is made runnable or
the current thread explicitly causes another thread to run
by calling sched_yield().
SCHED_RR All threads created with the creation attribute attr are
scheduled in pre-emptive, priority order with a time quan-
tum. Rescheduling can occur if a higher priority thread
is made runnable, the current thread uses up its quantum,
or the current thread explicitly causes another thread to
run by calling sched_yield().
SCHED_OTHER All threads created with the creation attribute attr are
scheduled in an implementation defined way. In this im-
plementation SCHED_OTHER is the same as SCHED_RR.
The default value for policy in an attribute object is SCHED_RR.
RETURN VALUES
Upon successful completion, the pthread_attr_getschedpolicy and
pthread_attr_setschedpolicy functions return 0. A non-zero result indi-
cates an error occurred.
ERRORS
The pthread_attr_getschedpolicy and pthread_attr_setschedpolicy functions
may fail and return the following error:
[EINVAL] The value of a function argument is invalid.
SEE ALSOpthreads(3), pthread_attr(3), pthread_create(3), pthread_join(3),
pthread_detach(3),
STANDARDS
The pthread_attr_getschedpolicy and pthread_attr_setschedpolicy functions
conform to IEEE Std1003.1c (``POSIX'').
HISTORY
The pthread_attr_getschedpolicy and pthread_attr_setschedpolicy functions
first appeared in BSD/OS 3.0.
BUGS
Specifying SCHED_OTHER in a call to pthread_attr_setschedpolicy() is non-
portable and is discouraged.
4th Berkeley Distribution June 3, 1996 2