DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

pthread_attr_setschedpolicy(3pthread)


pthread_attr_setschedpolicy, pthread_attr_getschedpolicy -- set and get schedpolicy attribute

Synopsis

cc [options] -Kthread file

#include <pthread.h>

int pthread_attr_setschedpolicy(pthread_attr_t *attr, int policy); int pthread_attr_getschedpolicy(const pthread_attr_t *attr, int *policy);

Description

pthread_attr_setschedpolicy and pthread_attr_getschedpolicy respectively, set and get the schedpolicy attribute in the attr argument.

The supported values of policy include SCHED_FIFO, SCHED_RR and SCHED_OTHER, which are defined by the header sched.h. When threads executing with the scheduling policy SCHED_FIFO or SCHED_RR are waiting on a mutex, they acquire the mutex in priority order when the mutex is unlocked.

Usage

After these attributes have been set, a thread can be created with the specified attributes using pthread_create(3pthread). Using these routines does not affect the current running thread.

Return values

If successful, pthread_attr_setschedpolicy and pthread_attr_getschedpolicy return zero. Otherwise, an error number is returned to indicate the error.

Diagnostics

If the foolowing condition is detected, pthread_attr_setschedpolicy and pthread_attr_getschedpolicy will return the corresponding value:

EINVAL
invalid attribute

If the following condition is detected, pthread_attr_setschedpolicy will return the corresponding value:


ENOTSUP
attempt to set the attribute to an unsupported value

References

pthread_attr_init(3pthread), pthread_attr_setscope(3pthread), pthread_attr_setinheritsched(3pthread), pthread_attr_setschedparam(3pthread), pthread_create(3pthread), pthread_setschedparam(3pthread), pthread(4), sched(4)

Standards compliance

The Single UNIX Specification, Version 2; The Open Group.
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004