Multithreaded Programming Guide

Setting the Mutex's Priority Ceiling

pthread_mutexattr_setprioceiling(3C) sets the priority ceiling of a mutex.

pthread_mutex_setprioceiling Syntax

#include <pthread.h> 
int pthread_mutex_setprioceiling(pthread_mutex_t *restrict mutex, 
          int prioceiling, int *restrict old_ceiling);

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

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.

pthread_mutex_setprioceiling Return Values

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

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


EINVAL

Description:

The priority requested by prioceiling is out of range.


EINVAL

Description:

The mutex was not initialized with its protocol attribute having the value of THREAD_PRIO_PROTECT.


EPERM

Description:

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