PTHREAD_MUTEX_CONSISTENT(3C) Standard C Library Functions

NAME


pthread_mutex_consistent - mark state protected by robust mutex as
consistent

SYNOPSIS


#include <pthread.h>

int
pthread_mutex_consistent(pthread_mutex_t *mutex);

DESCRIPTION


The pthread_mutex_consistent() 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 pthread_mutex_consistent() 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.

RETURN VALUES


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.

ERRORS


The pthread_mutex_consistent() function will fail if:

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

INTERFACE STABILITY


Committed

MT-LEVEL
MT-Safe

SEE ALSO


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

illumos December 22, 2014 illumos