Multithreaded Programming Guide


pthread_mutexattr_setprioceiling(3T) sets the priority ceiling attribute of a mutex attribute object.

#include <pthread.h>

int pthread_mutexattr_setprioceiling(pthread_mutexattr_t *attr, int prioceiling, int *oldceiling);

attr points to a mutex attribute object created by an earlier call to pthread_mutexattr_init().

Note -

The attr mutex attribute object includes the priority ceiing attribute only if the symbol _POSIX_THREAD_PRIO_PROTECT is defined.

prioceiling specifies the priority ceiling of initialized mutexes. The ceiling defines the minimum priority level at which the critical section guarded by the mutex is executed. prioceiling will be within the maximum range of priorities defined by SCHED_FIFO. To avoid priority inversion, prioceiling will be set to a priority higher than or equal to the highest priority of all the threads that might lock the particular mutex.

oldceiling contains the old priority ceiling value.

Return Values

On successful completion, pthread_mutexattr_setprioceiling() returns 0. Any other returned value indicates that an error occurred.

If any of the following conditions occurs, pthread_mutexattr_setprioceiling() fails and returns the corresponding value.


The option _POSIX_THREAD_PRIO_PROTECT is not defined and the implementation does not support the function.

If either of the following conditions occurs, pthread_mutexattr_setprioceiling() might fail and return the corresponding value.


The value specified by attr or prioceiling is invalid.


The caller does not have the privilege to perform the operation.