HP-UX Reference (11i v1 00/12) - 3 Library Functions N-Z (vol 7)

__________________________________________________________________________________________________________________________________________________________________________________________________
__________________________________________________________________________________________________________________________________________________________________________________________________
STANDARD Printed by: Nora Chuang [nchuang] STANDARD
/build/1111/BRICK/man3/nan.3m
________________________________________________________________
___ ___
p
pthread_mutexattr_getprotocol(3T) pthread_mutexattr_getprotocol(3T)
(Pthread Library)
NAME
pthread_mutexattr_getprioceiling(), pthread_mutexattr_setprioceiling(), pthread_mutexattr_getprotocol(),
pthread_mutexattr_setprotocol() - get and set the prioceiling and protocol attributes
SYNOPSIS
#include <pthread.h>
int pthread_mutexattr_setprioceiling(pthread_mutexattr_t *attr,
int prioceiling);
int pthread_mutexattr_getprioceiling(const pthread_mutexattr_t *attr,
int *prioceiling);
int pthread_mutexattr_setprotocol(pthread_mutexattr_t *attr,
int protocol);
int pthread_mutexattr_getprotocol(const pthread_mutexattr_t *attr,
int *protocol);
PARAMETERS
attr Pointer to the mutex attributes object whose attributes are to be set/retrieved.
prioceiling
This parameter either specifies the new value of the prioceiling attribute (set function) or
points to the memory location where the prioceiling attribute of attr is to be returned (get
function).
protocol This parameter either specifies the new value of the protocol attribute (set function) or
points to the memory location where the protocol attribute of attr is to be returned (get
function).
DESCRIPTION
Be sure to check for the definitions of
_POSIX_THREAD_PRIO_PROTECT
and
_POSIX_THREAD_PRIO_INHERIT
before using these functions. Not all systems will support these
functions.
The attributes object attr must have previously been initialized with the function
pthread_mutexattr_init()
before these functions are called.
ATTRIBUTE: protocol
Mutexes can be initialized with a priority protocol to help avoid or minimize the priority inversion that can
be caused by locked mutexes. The protocol attribute in a mutex attributes object describes the priority pro-
tocol to be used when the mutex is locked by a thread. The legal values for the protocol attribute are:
PTHREAD_PRIO_NONE
A thread’s scheduling priority is not changed when it locks this type of mutex.
PTHREAD_PRIO_PROTECT
These types of mutexes have an associated priority value in the prioceiling attribute. When a
thread locks a mutex of this type, its scheduling priority will be changed to be the value con-
tained in the prioceiling attribute. The value of prioceiling must be higher than the locking
thread’s scheduling priority. When the mutex is unlocked, the thread’s previous scheduling
priority will be restored.
If a thread owns several mutexes of this type, its scheduling priority will be changed to the
higher of all the prioceiling attributes for all mutexes of this type that it owns.
PTHREAD_PRIO_INHERIT
When a thread must block waiting for a mutex of this type, the system will change the schedul-
ing priority of the thread that owns the mutex to be the higher of its own priority or the priority
of the highest priority thread blocked on the mutex. When the mutex is unlocked, the thread’s
previous scheduling priority will be restored.
If a thread owns one or more mutexes having the protocol attribute value of PTHREAD_PRIO_PROTECT
or PTHREAD_PRIO_INHERIT, the thread will not be moved to the tail of its priority list if its original
priority is changed or when it unlocks the mutex(es).
If a thread owns mutexes of different priority protocols, it will execute at the highest of the priorities that
would be obtained by each of these protocols. If this thread becomes blocked on another mutex, the priority
behavior is recursive and is passed on to the thread that owns the mutex on which this thread is blocked.
Section 3694 1 HP-UX Release 11i: December 2000
___
___