pthread_mutexattr_getprioceiling or pthread_mutexattr_setprioceiling Subroutine

Purpose

Gets and sets the prioceiling attribute of the mutex attributes object.

Syntax

#include <pthread.h>

int pthread_mutexattr_getprioceiling(const pthread_mutexattr_t *
       restrict attr, int *restrict prioceiling);
int pthread_mutexattr_setprioceiling(pthread_mutexattr_t *attr,
       int prioceiling);

Description

The pthread_mutexattr_getprioceiling and pthread_mutexattr_setprioceiling subroutines, respectively, get and set the priority ceiling attribute of a mutex attributes object pointed to by the attr parameter, which was previously created by the pthread_mutexattr_init subroutine.

The prioceiling attribute contains the priority ceiling of initialized mutexes. The values of the prioceiling parameter are within the maximum range of priorities defined by SCHED_FIFO.

The prioceiling parameter defines the priority ceiling of initialized mutexes, which is the minimum priority level at which the critical section guarded by the mutex is executed. In order to avoid priority inversion, the priority ceiling of the mutex is set to a priority higher than or equal to the highest priority of all the threads that may lock that mutex. The values of the prioceiling parameter are within the maximum range of priorities defined under the SCHED_FIFO scheduling policy.

Return Values

Upon successful completion, the pthread_mutexattr_getprioceiling and pthread_mutexattr_setprioceiling subroutines return zero; otherwise, an error number shall be returned to indicate the error.

Error Codes

The pthread_mutexattr_getprioceiling and pthread_mutexattr_setprioceiling subroutines can fail if:
Item Description
EINVAL The value specified by the attr or prioceiling parameter is invalid.
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.