| 1 |
.\" Copyright 2017, Yubin Ruan <[email protected]> |
| 2 |
.\" Copyright 2017, Michael Kerrisk <[email protected]> |
| 3 |
.\" Copyright, the authors of the Linux man-pages project |
| 4 |
.\" |
| 5 |
.\" SPDX-License-Identifier: Linux-man-pages-copyleft |
| 6 |
.\" |
| 7 |
.TH pthread_mutex_consistent 3 2026-02-08 "Linux man-pages 6.18" |
| 8 |
.SH NAME |
| 9 |
pthread_mutex_consistent \- make a robust mutex consistent |
| 10 |
.SH LIBRARY |
| 11 |
POSIX threads library |
| 12 |
.RI ( libpthread ,\~ \-lpthread ) |
| 13 |
.SH SYNOPSIS |
| 14 |
.nf |
| 15 |
.B #include <pthread.h> |
| 16 |
.P |
| 17 |
.BI "int pthread_mutex_consistent(pthread_mutex_t *" mutex ");" |
| 18 |
.fi |
| 19 |
.P |
| 20 |
.RS -4 |
| 21 |
Feature Test Macro Requirements for glibc (see |
| 22 |
.BR feature_test_macros (7)): |
| 23 |
.RE |
| 24 |
.P |
| 25 |
.BR pthread_mutex_consistent (): |
| 26 |
.nf |
| 27 |
_POSIX_C_SOURCE >= 200809L |
| 28 |
.fi |
| 29 |
.SH DESCRIPTION |
| 30 |
This function makes a robust mutex consistent if it is in an inconsistent |
| 31 |
state. |
| 32 |
A mutex can be left in an inconsistent state if its owner terminates |
| 33 |
while holding the mutex, in which case the next owner who acquires the |
| 34 |
mutex will succeed and be notified by a return value of |
| 35 |
.B EOWNERDEAD |
| 36 |
from a call to |
| 37 |
.BR pthread_mutex_lock (). |
| 38 |
.SH RETURN VALUE |
| 39 |
On success, |
| 40 |
.IR pthread_mutex_consistent () |
| 41 |
returns 0. |
| 42 |
Otherwise, |
| 43 |
it returns a positive error number to indicate the error. |
| 44 |
.SH ERRORS |
| 45 |
.TP |
| 46 |
.B EINVAL |
| 47 |
The mutex is either not robust or is not in an inconsistent state. |
| 48 |
.SH STANDARDS |
| 49 |
POSIX.1-2008. |
| 50 |
.SH HISTORY |
| 51 |
glibc 2.12. |
| 52 |
POSIX.1-2008. |
| 53 |
.P |
| 54 |
Before the addition of |
| 55 |
.BR pthread_mutex_consistent () |
| 56 |
to POSIX, |
| 57 |
glibc defined the following equivalent nonstandard function if |
| 58 |
.B _GNU_SOURCE |
| 59 |
was defined: |
| 60 |
.P |
| 61 |
.nf |
| 62 |
.B [[deprecated]] |
| 63 |
.BI "int pthread_mutex_consistent_np(const pthread_mutex_t *" mutex ); |
| 64 |
.fi |
| 65 |
.P |
| 66 |
This GNU-specific API, which first appeared in glibc 2.4, |
| 67 |
is nowadays obsolete and should not be used in new programs; |
| 68 |
since glibc 2.34 it has been marked as deprecated. |
| 69 |
.SH NOTES |
| 70 |
.BR pthread_mutex_consistent () |
| 71 |
simply informs the implementation that the state (shared data) |
| 72 |
guarded by the mutex has been restored to a consistent state and that |
| 73 |
normal operations can now be performed with the mutex. |
| 74 |
It is the application's responsibility to ensure that the |
| 75 |
shared data has been restored to a consistent state before calling |
| 76 |
.BR pthread_mutex_consistent (). |
| 77 |
.SH EXAMPLES |
| 78 |
See |
| 79 |
.BR pthread_mutexattr_setrobust (3). |
| 80 |
.SH SEE ALSO |
| 81 |
.ad l |
| 82 |
.nh |
| 83 |
.BR pthread_mutex_lock (3), |
| 84 |
.BR pthread_mutexattr_getrobust (3), |
| 85 |
.BR pthread_mutexattr_init (3), |
| 86 |
.BR pthread_mutexattr_setrobust (3), |
| 87 |
.BR pthreads (7) |