pthread_mutex_getprioceiling or pthread_mutex_setprioceiling Subroutine

Purpose

Gets and sets the priority ceiling of a mutex.

Syntax

#include <pthread.h>

int pthread_mutex_getprioceiling(const pthread_mutex_t *restrict mutex,
       int *restrict prioceiling);
int pthread_mutex_setprioceiling(pthread_mutex_t *restrict mutex,
       int prioceiling, int *restrict old_ceiling);

Description

The pthread_mutex_getprioceiling subroutine returns the current priority ceiling of the mutex.

The pthread_mutex_setprioceiling subroutine either locks the mutex if it is unlocked, or blocks until it can successfully lock the mutex, then it changes the mutex's priority ceiling and releases the mutex. When the change is successful, the previous value of the priority ceiling shall be returned in old_ceiling. The process of locking the mutex need not adhere to the priority protect protocol.

If the pthread_mutex_setprioceiling subroutine fails, the mutex priority ceiling is not changed.

Return Values

If successful, the pthread_mutex_getprioceiling and pthread_mutex_setprioceiling subroutines return zero; otherwise, an error number is returned to indicate the error.

Error Codes

The pthread_mutex_getprioceiling and pthread_mutex_setprioceilingsubroutines can fail if:
Item Description
EINVAL The priority requested by the prioceiling parameter is out of range.
EINVAL The value specified by the mutex parameter does not refer to a currently existing mutex.
ENOSYS This function is not supported (draft 7).
ENOTSUP This function is not supported together with checkpoint/restart.
EPERM The caller does not have the privilege to perform the operation in a strictly standards conforming environment where environment variable XPG_SUS_ENV=ON.