Multithreaded Programming Guide


pthread_mutex_setprioceiling(3T) sets the priority ceiling of a mutex.

#include <pthread.h>

int pthread_mutex_setprioceiling(pthread_mutexatt_t *mutex, int prioceiling, int *old_ceiling);

pthread_mutex_setprioceiling() changes the priority ceiling, prioceiling, of a mutex, mutex. pthread_mutex_setprioceiling() locks the mutex if it is unlocked, or blocks until it can successfully lock the mutex, changes the priority celing of the mutex and releases the mutex. The process of locking the mutex need not adhere to the priority protect protocol.

Note -

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

If pthread_mutex_setprioceiling() succeeds, the previous value of the priority ceiling is returned in old_ceiling. If pthread_mutex_setprioceiling() fails, the mutex priority ceiling remains unchanged.

Return Values

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

If the following condition occurs, pthread_mutexatt_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 any of the following conditions occurs, pthread_mutex_setprioceiling() might fail and return the corresponding value.


The priority requested by prioceiling is out of range.


The value specified by mutex does not refer to a currently existing mutex.


The implementation does not support the priority ceiling protocol for mutexes.


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