VMS Help
DCE_THREADS, Application Routines, pthread_attr_setprio

 *Conan The Librarian (sorry for the slow response - running on an old VAX)

  NAME

      pthread_attr_setprio - Changes the scheduling priority attribute of
                             thread creation

  SYNOPSIS

      #include <pthread.h>

      int pthread_attr_setprio( pthread_attr_t *attr,
                                int priority );

  PARAMETERS

      attr                Thread attributes object modified.

      priority            New value for the priority attribute.  The
                          priority attribute depends on scheduling
                          policy. Valid values fall within one of the
                          following ranges:

                          o    PRI_OTHER_MIN <= priority <= PRI_OTHER_MAX
                               (use with the SCHED_OTHER policy)

                          o    PRI_FIFO_MIN <= priority <= PRI_FIFO_MAX
                               (use with the SCHED_FIFO policy)

                          o    PRI_RR_MIN <= priority <= PRI_RR_MAX
                               (use with the SCHED_RR policy)

                          o    PRI_FG_MIN_NP <= priority <= PRI_FG_MAX_NP
                               (use with the SCHED_FG_NP policy)

                          o    PRI_BG_MIN_NP <= priority <= PRI_BG_MAX_NP
                               (use with the SCHED_BG_NP policy)

  The  default  priority  is  the  midpoint  between   PRI_OTHER_MIN   and
  PRI_OTHER_MAX.  To  specify  a  minimum  or  maximum  priority,  use the
  appropriate  symbol;  for  example,  PRI_FIFO_MIN  or  PRI_FIFO_MAX.  To
  specify  a  value  between  the  minimum and maximum, use an appropriate
  arithmetic expression.   For  example,  to  specify  a  priority  midway
  between  the  minimum and maximum for the Round Robin scheduling policy,
  specify the following concept using your programming language's syntax:

      pri_rr_mid = (PRI_RR_MIN + PRI_RR_MAX)/2

  If your expression results in a value outside the range  of  minimum  to
  maximum, an error results when you attempt to use it.

  DESCRIPTION

  The  pthread_attr_setprio()  routine  sets  the  execution  priority  of
  threads  that  are  created using the attributes object specified by the
  attr parameter.

  By default, a created thread inherits the priority of the thread calling
  pthread_create().  To  specify a priority using this routine, scheduling
  inheritance must be disabled at the time the thread is created.   Before
  calling      this      routine      and      pthread_create(),      call
  pthread_attr_setinheritsched()      and      specify      the      value
  PTHREAD_DEFAULT_SCHED for the inherit parameter.

  An application specifies priority only to express the urgency of execut-
  ing  the  thread relative to other threads. Priority is not used to con-
  trol mutual exclusion when accessing shared data.

  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       [ERANGE]   One or more parameters supplied have an
                        invalid value.
    -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_getprio
                  pthread_attr_setinheritsched
                  pthread_create
  Close     HLB-list     TLB-list     Help  

[legal] [privacy] [GNU] [policy] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.