xref: /titanic_52/usr/src/man/man3c/pthread_mutex_consistent.3c (revision d50bcaae2118610560f2b107d0d282315e47e4e4)
1.\"
2.\" This file and its contents are supplied under the terms of the
3.\" Common Development and Distribution License ("CDDL"), version 1.0.
4.\" You may only use this file in accordance with the terms of version
5.\" 1.0 of the CDDL.
6.\"
7.\" A full copy of the text of the CDDL should have accompanied this
8.\" source.  A copy of the CDDL is also available via the Internet at
9.\" http://www.illumos.org/license/CDDL.
10.\"
11.\"
12.\" Copyright (c) 2014, Joyent, Inc.
13.\"
14.Dd "Dec 22, 2014"
15.Dt PTHREAD_MUTEX_CONSISTENT 3C
16.Os
17.Sh NAME
18.Nm pthread_mutex_consistent
19.Nd mark state protected by robust mutex as consistent
20.Sh SYNOPSIS
21.In pthread.h
22.Ft int
23.Fo pthread_mutex_consistent
24.Fa "pthread_mutex_t *mutex"
25.Fc
26.Sh DESCRIPTION
27The
28.Fn pthread_mutex_consistent
29function is used to indicate that a robust lock that is in an
30inconsistent state no longer is.
31.Lp
32A robust lock enters into an inconsistent state when a process or thread
33holding a robust lock exits, such as by calling
34.Xr exit 2
35or
36.Xr thr_exit 3C ,
37or crashes without unlocking the lock. At that point, if another process
38or thread is currently in a call, or calls
39.Xr pthread_mutex_lock 3C ,
40it will obtain the lock; however, the error code
41.Er EOWNERDEAD
42will be returned. In such cases, that thread will own the lock and must
43check and clean up any inconsistent state that is protected by the lock.
44When finished, it must call
45.Fn pthread_mutex_consistent
46to indicate that it is in a consistent state again.
47.Lp
48If a process or thread obtains a robust lock while it is in an
49inconsistent state and it crashes or terminates before marking the lock
50as consistent, the next process or thread that obtains the lock will
51receive
52.Er EOWNERDEAD .
53.Sh RETURN VALUES
54Upon successful completion, the
55.Fn pthread_mutex_consistent
56returns zero and marks
57.Va mutex
58as consistent. Callers of
59.Fn pthread_mutex_lock
60will not have
61.Er EOWNERDEAD
62returned until another process or thread exits without unlocking. Upon
63failure, an error will be returned which corresponds to one of the
64errors listed below.
65.Sh ERRORS
66The
67.Fn pthread_mutex_consistent
68function will fail if:
69.Bl -tag -width Er
70.It Er EINVAL
71.Va mutex
72is an uninitialized mutex, not a robust mutex, or not in an inconsistent
73state.
74.El
75.Sh INTERFACE STABILITY
76.Sy Committed
77.Sh MT-LEVEL
78.Sy MT-Safe
79.Sh SEE ALSO
80.Xr pthread_mutex_destroy 3C ,
81.Xr pthread_mutex_init 3C ,
82.Xr pthread_mutex_lock 3C ,
83.Xr pthread_mutexattr_getrobust 3C ,
84.Xr pthread 3HEAD ,
85.Xr libpthread 3LIB ,
86.Xr attributes 5 ,
87.Xr mutex 5
88