DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

pthread_attr_setinheritsched(3pthread)


pthread_attr_setinheritsched, pthread_attr_getinheritsched -- set and get inheritsched attribute

Synopsis

cc [options] -Kthread file

#include <pthread.h>

int pthread_attr_setinheritsched(pthread_attr_t *attr, int inheritsched); int pthread_attr_getinheritsched(const pthread_attr_t *attr, int *inheritsched);

Description

pthread_attr_setinheritsched and pthread_attr_getinheritsched, respectively, set and get the inheritsched attribute in the attr argument.

When the attribute objects are used by pthread_create(3pthread), the inheritsched attribute determines how the other scheduling attributes of the created thread are to be set:


PTHREAD_INHERIT_SCHED
Specifies that the scheduling policy and associated attributes are to be inherited from the creating thread, and the scheduling attributes in this attr argument are to be ignored.

PTHREAD_EXPLICIT_SCHED
Specifies that the scheduling policy and associated attributes are to be set to the corresponding values from this attribute object.

The symbols PTHREAD_INHERIT_SCHED and PTHREAD_EXPLICIT_SCHED are defined in the header pthread.h.

Usage

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

Return values

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

Diagnostics

If the following conditions are detected, pthread_attr_setinheritsched and pthread_attr_getinheritsched will return the corresponding value:

ENOSYS
_POSIX_THREAD_PRIORITY_SCHEDULING is not defined and the implementation does not support the function

EINVAL
invalid attribute value

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


ENOTSUP
unsupported attribute value

References

pthread_attr_init(3pthread), pthread_attr_setscope(3pthread), pthread_attr_setschedpolicy(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