United States-English |
|
|
HP-UX Reference > Ppthread_mutexattr_getprotocol(3T)Pthread LibraryHP-UX 11i Version 3: February 2007 |
|
NAMEpthread_mutexattr_getprotocol(), pthread_mutexattr_setprotocol(), pthread_mutexattr_getprioceiling(), pthread_mutexattr_setprioceiling() — get and set the protocol and prioceiling attributes SYNOPSIS#include <pthread.h> int pthread_mutexattr_setprioceiling(pthread_mutexattr_t *attr, int prioceiling); int pthread_mutexattr_getprioceiling(const pthread_mutexattr_t *__restrict attr, int *__restrict prioceiling); int pthread_mutexattr_setprotocol(pthread_mutexattr_t *attr, int protocol); int pthread_mutexattr_getprotocol(const pthread_mutexattr_t *__restrict attr, int *__restrictprotocol); PARAMETERS
DESCRIPTIONBe 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: protocolMutexes 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 protocol to be used when the mutex is locked by a thread. The legal values for the protocol attribute are:
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. POSIX.1c does not define a default value for the protocol attribute. On HP-UX, the default value is PTHREAD_PRIO_NONE. pthread_mutexattr_setprotocol() is used to set the protocol attribute in the initialized attributes object attr. The new value of the protocol attribute of attr is set to the value specified in the protocol parameter. pthread_mutexattr_getprotocol() retrieves the value of the protocol attribute from the mutex attributes object attr. The value of the protocol attribute of attr is returned in the protocol parameter. ATTRIBUTE: prioceilingIf the protocol attribute has a value of PTHREAD_PRIO_PROTECT, the prioceiling attribute indicates the priority ceiling of the mutex. Otherwise, this attribute is not used when the mutex is initialized. The priority values that are valid for this attribute are the same values that are valid for the SCHED_FIFO scheduling policy. POSIX.1c does not define a default value for the prioceiling attribute. On HP-UX, the default value is the minimum priority value for the SCHED_FIFO scheduling policy. pthread_mutexattr_setprioceiling() is used to set the prioceiling attribute in the initialized attributes object attr. The new value of the prioceiling attribute of attr is set to the value specified in the prioceiling parameter. pthread_mutexattr_getprioceiling() retrieves the value of the prioceiling attribute from the mutex attributes object attr. The value of the prioceiling attribute of attr is returned in the prioceiling parameter. RETURN VALUEUpon successful completion, pthread_mutexattr_setprioceiling(), pthread_mutexattr_getprioceiling(), pthread_mutexattr_setprotocol(), and pthread_mutexattr_getprotocol() return zero. Otherwise, an error number is returned to indicate the error (the errno variable is not set). ERRORSIf any of the following occur, the pthread_mutexattr_setprioceiling(), pthread_mutexattr_getprioceiling(), pthread_mutexattr_setprotocol(), and pthread_mutexattr_getprotocol() functions return the corresponding error number:
For each of the following conditions, if the condition is detected, the pthread_mutexattr_setprioceiling(), pthread_mutexattr_getprioceiling(), pthread_mutexattr_setprotocol(), and pthread_mutexattr_getprotocol() functions return the corresponding error number:
|
Printable version | ||
|