Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

pthread_attr_setinheritsched(3) [osf1 man page]

pthread_attr_setinheritsched(3) 			     Library Functions Manual				   pthread_attr_setinheritsched(3)

NAME
pthread_attr_setinheritsched - Changes the inherit scheduling attribute of the specified thread attributes object. LIBRARY
DECthreads POSIX 1003.1c Library (libpthread.so) SYNOPSIS
#include <pthread.h> int pthread_attr_setinheritsched( pthread_attr_t *attr, int inheritsched); STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: IEEE Std 1003.1c-1995, POSIX System Application Program Interface PARAMETERS
Thread attributes object whose inherit scheduling attribute is to be modified. New value for the inherit scheduling attribute. Valid val- ues are as follows: The created thread inherits the scheduling policy and associated scheduling attributes of the thread calling pthread_create(3). Any scheduling attributes in the attributes object specified by the pthread_create(3) attr argument are ignored during thread creation. This is the default value. The scheduling policy and associated scheduling attributes of the created thread are set to the corresponding values from the attribute object specified by the pthread_create(3) attr argument. DESCRIPTION
This routine changes the inherit scheduling attribute of the thread attributes object specified by the attr argument. The inherit schedul- ing attribute specifies whether a thread created using the specified attributes object inherits the scheduling attributes of the creating thread, or uses the scheduling attributes stored in the attributes object specified by the pthread_create(3) attr argument. The first thread in an application has a scheduling policy of SCHED_OTHER. See the pthread_attr_setschedparam(3) and pthread_attr_setschedpolicy(3) 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--that is, threads that are intended to work closely with the creating thread to cooperatively solve the same problem. For example, inherited scheduling attributes ensure that helper threads created in a sort routine execute with the same pri- ority as the calling thread. RETURN VALUES
If an error condition occurs, this routine returns an integer value indicating the type of error. Possible return values are as follows: Successful completion. The value specified by the attr argument is not a valid thread attributes object, or the inheritsched argument con- tains an invalid value. An attempt was made to set the attribute to an unsupported value. ERRORS
None RELATED INFORMATION
Functions: pthread_attr_init(3), pthread_attr_getinheritsched(3), pthread_attr_setschedpolicy(3), pthread_attr_setschedparam(3), pthread_create(3) Manuals: Guide to DECthreads and Programmer's Guide delim off pthread_attr_setinheritsched(3)

Check Out this Related Man Page

PTHREAD_ATTR_SETINHERITSCHED(3) 			     Linux Programmer's Manual				   PTHREAD_ATTR_SETINHERITSCHED(3)

NAME
pthread_attr_setinheritsched, pthread_attr_getinheritsched - set/get inherit scheduler attribute in thread attributes object SYNOPSIS
#include <pthread.h> int pthread_attr_setinheritsched(pthread_attr_t *attr, int inheritsched); int pthread_attr_getinheritsched(pthread_attr_t *attr, int *inheritsched); Compile and link with -pthread. DESCRIPTION
The pthread_attr_setinheritsched() function sets the inherit scheduler attribute of the thread attributes object referred to by attr to the value specified in inheritsched. The inherit scheduler attribute determines whether a thread created using the thread attributes object attr will inherit its scheduling attributes from the calling thread or whether it will take them from attr. The following values may be specified in inheritsched: PTHREAD_INHERIT_SCHED Threads that are created using attr inherit scheduling attributes from the creating thread; the scheduling attributes in attr are ignored. PTHREAD_EXPLICIT_SCHED Threads that are created using attr take their scheduling attributes from the values specified by the attributes object. The default setting of the inherit scheduler attribute in a newly initialized thread attributes object is PTHREAD_INHERIT_SCHED. The pthread_attr_getinheritsched() returns the inherit scheduler attribute of the thread attributes object attr in the buffer pointed to by inheritsched. RETURN VALUE
On success, these functions return 0; on error, they return a nonzero error number. ERRORS
pthread_attr_setinheritsched() can fail with the following error: EINVAL Invalid value in inheritsched. POSIX.1-2001 also documents an optional ENOTSUP error ("attempt was made to set the attribute to an unsupported value") for pthread_attr_setinheritsched(). CONFORMING TO
POSIX.1-2001. EXAMPLE
See pthread_setschedparam(3). BUGS
As at glibc 2.8, if a thread attributes object is initialized using pthread_attr_init(3), then the scheduling policy of the attributes object is set to SCHED_OTHER and the scheduling priority is set to 0. However, if the inherit scheduler attribute is then set to PTHREAD_EXPLICIT_SCHED, then a thread created using the attribute object wrongly inherits its scheduling attributes from the creating thread. This bug does not occur if either the scheduling policy or scheduling priority attribute is explicitly set in the thread attributes object before calling pthread_create(3). SEE ALSO
sched_setscheduler(2), pthread_attr_init(3), pthread_attr_setschedparam(3), pthread_attr_setschedpolicy(3), pthread_create(3), pthread_setschedparam(3), pthread_setschedprio(3), pthreads(7) COLOPHON
This page is part of release 3.25 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. Linux 2008-11-10 PTHREAD_ATTR_SETINHERITSCHED(3)
Man Page