#include <pthread.h> int pthread_mutex_consistent_np(pthread_mutex_t *mutex);
pthread_mutex_consistent_np() applies only if the symbol _POSIX_THREAD_PRIO_INHERIT is defined and for mutexes that are initialized with the protocol attribute value PTHREAD_PRIO_INHERIT.
If the owner of a mutex dies, the mutex can become inconsistent.
pthread_mutex_consistent_np makes the mutex object, mutex, consistent after the death of its owner.
Call pthread_mutex_lock() to acquire the inconstent mutex. The EOWNWERDEAD return value indicates an inconsistent mutex.
Call pthread_mutex_consistent_np() while holding the mutex acquired by a previuos call to pthread_mutex_lock().
Because the critical section protected by the mutex might have been left in an inconsistent state by the dead owner, make the mutex consistent only if you are able to make the critical section protected by the mutex consistent.
Calls to pthread_mutex_lock(), pthread_mutex_unlock(), and pthread_mutex_trylock() for a consistent mutex behave in the normal manner.
The behavior of pthread_mutex_consistent_np() for a mutex that is not inconsistent, or that is not held, is undefined.
pthread_mutex_consistent_np() returns zero after completing successfully. Any other returned value indicates that an error occurred. When any of the following conditions occurs, the function fails and returns the corresponding value.
pthread_mutex_consistent_np() fails if:
The option _POSIX_THREAD_PRIO_INHERIT is not defined or the implementation does not support pthread_mutex_consistent_np().
pthread_mutex_consistent_np() might fail if: