Debian Codegraph @

upstream/debian-trixie/man3/pthread_mutex_consistent.3

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