pthread_mutex_consistent_Standard C Library Funpthread_mutex_consistent_np(3C)NAMEpthread_mutex_consistent_np - make a robust mutex consistent after
owner death
SYNOPSIS
cc -mt [ flag... ] file... -lpthread [ library... ]
#include <pthread.h>
int pthread_mutex_consistent_np(pthread_mutex_t *mutex);
DESCRIPTION
The following applies only to mutexes that have been initialized with
the PTHREAD_MUTEX_ROBUST_NP attribute. See pthread_mutexattr_getro‐
bust_np(3C).
The mutex object referenced by mutex is made consistent by calling
pthread_mutex_consistent_np().
A consistent mutex becomes inconsistent and is unlocked if its owner
dies while holding it, or if the process containing the owner of the
mutex unmaps the memory containing the mutex or performs one of the
exec(2) functions. A subsequent owner of the mutex will acquire the
mutex with pthread_mutex_lock(3C), which will return EOWNERDEAD to
indicate that the acquired mutex is inconsistent.
The pthread_mutex_consistent_np() function should be called while hold‐
ing the mutex acquired by a previous call to pthread_mutex_lock() that
returned EOWNERDEAD.
Since the critical section protected by the mutex could have been left
in an inconsistent state by the dead owner, the caller should make the
mutex consistent only if it is able to make the critical section pro‐
tected by the mutex consistent.
Calls to pthread_mutex_lock(), pthread_mutex_unlock(), and
pthread_mutex_trylock() for a consistent mutex will behave in the nor‐
mal manner.
RETURN VALUES
Upon successful completion, the pthread_mutexattr_consistent_np() func‐
tion returns 0. Otherwise, an error number is returned to indicate the
error.
ERRORS
The pthread_mutex_consistent_np() function will fail if:
EINVAL The current thread does not own the mutex or the mutex is not
a PTHREAD_MUTEX_ROBUST_NP mutex having an inconsistent state
(EOWNERDEAD).
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
┌─────────────────────────────┬─────────────────────────────┐
│ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
├─────────────────────────────┼─────────────────────────────┤
│MT-Level │ MT-Safe │
└─────────────────────────────┴─────────────────────────────┘
SEE ALSOpthread_mutex_lock(3C), pthread_mutexattr_getrobust_np(3C),
attributes(5), mutex(5), standards(5)SunOS 5.10 5 Jun 2007 pthread_mutex_consistent_np(3C)