Multithreaded Programming Guide

pthread_mutexattr_setprioceiling(3THR)

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

#include <pthread.h>

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

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

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 return value indicates that an error occurred.

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


ENOSYS

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.


EINVAL

The value specified by attr or prioceiling is invalid.


EPERM

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