VMS Help  —  POSIX Threads, PTHREAD routines, pthread_attr_setinheritsched
    Changes the inherit scheduling attribute of the specified thread
    attributes object.

1  –  C Binding

    #include <pthread.h>

    int
    pthread_attr_setinheritsched (
             pthread_attr_t   *attr,
             int   inheritsched);

2  –  Arguments

 attr

    Thread attributes object whose inherit scheduling attribute is to
    be modified.

 inheritsched

    New value for the inherit scheduling attribute. Valid values are
    as follows:

       PTHREAD_INHERIT_      The created thread inherits the
       SCHED                 scheduling policy and associated
                             scheduling attributes of the thread
                             calling pthread_create(). Any scheduling
                             attributes in the attributes object
                             specified by the pthread_create() attr
                             argument are ignored during thread
                             creation. This is the default value.
       PTHREAD_EXPLICIT_     The scheduling policy and associated
       SCHED                 scheduling attributes of the created
                             thread are set to the corresponding
                             values from the attribute object
                             specified by the pthread_create()  attr
                             argument.

3  –  Description

    This routine changes the inherit scheduling attribute of the
    thread attributes object specified by the attr argument. The
    inherit scheduling 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() attr argument.

    The first thread in an application has a scheduling policy of
    SCHED_OTHER. See the pthread_attr_setschedparam() and pthread_
    attr_setschedpolicy() routines for more information on valid
    priority values and valid scheduling policy values.

    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 priority as the calling
    thread.

4  –  Return Values

    If an error condition occurs, this routine returns an integer
    value indicating the type of error. Possible return values are as
    follows:

    Return      Description

    0           Successful completion.
    [EINVAL]    The value specified by the attr argument is not a
                valid thread attributes object, or the inheritsched
                argument contains an invalid value.
    [ENOTSUP]   An attempt was made to set the attribute to an
                unsupported value.

5  –  Associated Routines

       pthread_attr_init()
       pthread_attr_getinheritsched()
       pthread_attr_setschedpolicy()
       pthread_attr_setschedparam()
       pthread_attr_setscope()
       pthread_create()
Close Help