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