xref: /freebsd/share/man/man3/pthread_mutex_consistent.3 (revision a64729f5077d77e13b9497cb33ecb3c82e606ee8)
1.\" Copyright (c) 2016 The FreeBSD Foundation, Inc.
2.\"
3.\" This documentation was written by
4.\" Konstantin Belousov <kib@FreeBSD.org> under sponsorship
5.\" from the FreeBSD Foundation.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions
9.\" are met:
10.\" 1. Redistributions of source code must retain the above copyright
11.\"    notice, this list of conditions and the following disclaimer.
12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\"    notice, this list of conditions and the following disclaimer in the
14.\"    documentation and/or other materials provided with the distribution.
15.\"
16.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
17.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
20.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26.\" SUCH DAMAGE.
27.\"
28.Dd March 27, 2017
29.Dt PTHREAD_MUTEX_CONSISTENT 3
30.Os
31.Sh NAME
32.Nm pthread_mutex_consistent
33.Nd mark state protected by robust mutex as consistent
34.Sh LIBRARY
35.Lb libpthread
36.Sh SYNOPSIS
37.In pthread.h
38.Ft int
39.Fn pthread_mutex_consistent "pthread_mutex_t *mutex"
40.Sh DESCRIPTION
41If the process containing the thread owning a robust mutex terminates
42while holding the mutex, the mutex becomes inconsistent and the next thread
43that acquires the mutex lock is notified of the state by the return value
44.Er EOWNERDEAD .
45In this case, the mutex does not become normally usable again until
46the state is marked consistent.
47.Pp
48The
49.Fn pthread_mutex_consistent ,
50when called with the
51.Fa mutex
52argument, which points to the initialized robust mutex in an
53inconsistent state, marks the by mutex as consistent again.
54The consequent unlock of the mutex, by either
55.Fn pthread_mutex_unlock
56or other methods, allows other contenders to lock the mutex.
57.Pp
58If the mutex in the inconsistent state is not marked consistent
59by the call to
60.Fn pthread_mutex_consistent
61before unlock,
62further attempts to lock the
63.Fa mutex
64result in the
65.Er ENOTRECOVERABLE
66condition reported by the locking functions.
67.Sh RETURN VALUES
68If successful,
69.Fn pthread_mutex_consistent
70will return zero, otherwise an error number will be returned to
71indicate the error.
72.Sh ERRORS
73The
74.Fn pthread_mutex_lock
75function will fail if:
76.Bl -tag -width Er
77.It Bq Er EINVAL
78The mutex pointed to by the
79.Fa mutex
80argument is not robust, or is not in the inconsistent state.
81.El
82.Sh SEE ALSO
83.Xr pthread_mutex_init 3 ,
84.Xr pthread_mutex_lock 3 ,
85.Xr pthread_mutex_unlock 3 ,
86.Xr pthread_mutexattr_setrobust 3
87.Sh STANDARDS
88The
89.Fn pthread_mutex_lock
90function conforms to
91.St -susv4 .
92