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