Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

pthread_attr_setsched(3T)

pthread_attr_setprio(3T)

sched_setparam(2)

sched_setscheduler(2)

threads(5)



pthread_getschedattr(3T)          SDK R4.11         pthread_getschedattr(3T)


NAME
       pthread_getschedattr, pthread_setschedattr - get or set thread
       scheduling attributes

SYNOPSIS
       #include <pthread.h>

       int pthread_getschedattr(pthread_t thread, pthread_attr_t *attrs);

       int pthread_setschedattr(pthread_t thread, pthread_attr_t *attrs);

   where:
       thread  The target thread's ID
       attrs   A pointer to a thread attributes object

DESCRIPTION
       The pthread_getschedattr() and pthread_setschedattr() functions
       retrieve and set the scheduling attributes of the thread whose thread
       ID is given by thread.  For these calls, only the scheduling policy
       and priority attributes are manipulated.  Other attributes, including
       all basic thread attributes and other scheduling attributes, are
       neither retrieved nor modified.

       The pthread_getschedattr() function retrieves the scheduling policy
       and priority for the thread whose thread ID is given by thread and
       stores those values in the attributes object pointed to by attrs.
       The pthread_setschedattr() function sets the scheduling policy and
       priority for the thread whose thread ID is given by thread to values
       provided in the attributes object pointed to by attrs.  These new
       attributes apply either locally or globally, depending on the
       contention scope of the target thread.

       Refer to pthread_setsched(3T), pthread_prio(3T), and <sched.h> for
       detailed descriptions of the scheduling policy and priority
       attributes.

       The values in the attributes object pointed to by attrs are not
       checked for full validity until they are used in calls to
       pthread_setschedattr and other functions such as pthread_create().
       Hence it is possible that certain combinations of values are either
       illegal or not permitted for the caller of these functions.

       Typically the user of these functions calls pthread_getschedattr() to
       retrieve the current scheduling policy and priority of the target
       thread, modifies one or both of these values in the attributes
       object, then calls pthread_setschedattr() to cause the new values to
       take affect for the target thread.

       If pthread_setschedattr() fails, no scheduling attributes are changed
       for the target thread.

DIAGNOSTICS
   Return Value
       If successful, pthread_getschedattr() and pthread_setschedattr()
       return 0.  Otherwise, they return -1 and set errno.

   Errors
       For each of the following conditions, pthread_getschedattr() and
       pthread_setschedattr() return -1 and set errno to the corresponding
       value:

       [ESRCH]   The value specified by thread does not refer to a existing
                 thread.

       [EINVAL]  An invalid attributes object has been specified.  This
                 occurs when DG/UX has detected that the attributes object
                 pointed to by attrs has not been initialized by a previous
                 call to pthread_attr_init() or has been corrupted.

       For each of the following conditions, pthread_setschedattr() returns
       -1 and set errno to the corresponding value:

       [EINVAL]  An invalid combination of scheduling policy and priority
                 has been specified in the attributes object pointed to by
                 attrs.

       [EPERM]   The caller does not have the appropriate privileges to set
                 either the priority or the scheduling policy of the
                 specified thread.  In DG/UX, this can never occur if the
                 target thread has local contention scope.

SEE ALSO
       pthread_attr_setsched(3T), pthread_attr_setprio(3T),
       sched_setparam(2), sched_setscheduler(2), threads(5).

NOTES
       Following the get-modify-set paradigm described above is advisable,
       as it conforms more easily to the addition of future scheduling
       attributes to the standard.

       In DG/UX, changing the scheduling policy and priority of a thread
       with global contention scope changes these attributes for both the
       thread and its dedicated thread group.   The two are always kept in
       sync for globally scheduled threads.


Licensed material--property of copyright holder(s)

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026