HELPLIB.HLB  —  DCE  DCE_THREADS, Application Routines, pthread_attr_setsched
 NAME

    pthread_attr_setsched - Changes the scheduling policy attribute of
                             thread creation

 SYNOPSIS

     #include <pthread.h>

     int pthread_attr_setsched( pthread_attr_t *attr
                                int *scheduler );

 PARAMETERS

     attr                Thread attributes object modified.

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

                         SCHED_FIFO (First In, First Out)
                              The highest-priority thread runs until it
                              blocks. If there is more than one thread
                              with the same priority, and that priority
                              is the highest among other threads, the
                              first thread to begin running continues
                              until it blocks.

                         SCHED_RR (Round Robin)
                              The highest-priority thread runs until it
                              blocks; however, threads of equal priority,
                              if that priority is the highest among other
                              threads, are timesliced.  Timeslicing is a
                              process in which threads alternate using
                              available processors.

                         SCHED_OTHER (Default)
                              All threads are timesliced. SCHED_OTHER
                              ensures that all threads, regardless of
                              priority, receive some scheduling so that
                              no thread is completely denied execution
                              time. (However, SCHED_OTHER threads can be
                              denied execution time by SCHED_FIFO or
                              SCHED_RR threads.)

                         SCHED_FG_NP (Foreground)
                              Same as SCHED_OTHER.  Threads are time-
                              sliced and priorities can be modified
                              dynamically by the scheduler to ensure
                              fairness.

                         SCHED_BG_NP (Background)
                              Ensures that all threads, regardless of
                              priority, receive some scheduling. However,
                              SCHED_BG_NP can be denied execution by
                              SCHED_FIFO or SCHED_RR threads.

 DESCRIPTION

 The pthread_attr_setsched() routine sets the scheduling policy of a
 thread that is created using the attributes object specified by the attr
 parameter. The default value of the scheduling attribute is SCHED_OTHER.

 RETURN VALUES

 If the function fails, errno may be set to one of the following values:

    Return   Error      Description
    ___________________________________________________________
    0                   Successful completion.

    -1     [EINVAL]     The value specified by attr is invalid.

    -1     [EINVAL]     The value specified by scheduler is invalid.

    -1     [EPERM]      The caller does not have the appropriate
                        privileges to set the priority of the
                        specified thread.

 RELATED INFORMATION

      FUNCTIONS: pthread_attr_create
                 pthread_attr_getsched
                 pthread_attr_setinheritsched
                 pthread_create
Close Help