PTHREAD_MUTEX_CONSISTENT(3C) Standard C Library Functions PTHREAD_MUTEX_CONSISTENT(3C)

pthread_mutex_consistentmark state protected by robust mutex as consistent

#include <pthread.h>

int
pthread_mutex_consistent(pthread_mutex_t *mutex);

The () function is used to indicate that a robust lock that is in an inconsistent state no longer is.

A robust lock enters into an inconsistent state when a process or thread holding a robust lock exits, such as by calling exit(2) or thr_exit(3C), or crashes without unlocking the lock. At that point, if another process or thread is currently in a call, or calls pthread_mutex_lock(3C), it will obtain the lock; however, the error code EOWNERDEAD will be returned. In such cases, that thread will own the lock and must check and clean up any inconsistent state that is protected by the lock. When finished, it must call () to indicate that it is in a consistent state again.

If a process or thread obtains a robust lock while it is in an inconsistent state and it crashes or terminates before marking the lock as consistent, the next process or thread that obtains the lock will receive EOWNERDEAD.

Upon successful completion, the pthread_mutex_consistent() returns zero and marks mutex as consistent. Callers of pthread_mutex_lock() will not have EOWNERDEAD returned until another process or thread exits without unlocking. Upon failure, an error will be returned which corresponds to one of the errors listed below.

The pthread_mutex_consistent() function will fail if:

mutex is an uninitialized mutex, not a robust mutex, or not in an inconsistent state.

pthread_mutex_destroy(3C), pthread_mutex_init(3C), pthread_mutex_lock(3C), pthread_mutexattr_getrobust(3C), pthread(3HEAD), libpthread(3LIB), attributes(7), mutex(7)

December 22, 2014 OmniOS