12a339d9eSKonstantin Belousov.\" Copyright (c) 2016 The FreeBSD Foundation, Inc. 22a339d9eSKonstantin Belousov.\" All rights reserved. 32a339d9eSKonstantin Belousov.\" 42a339d9eSKonstantin Belousov.\" This documentation was written by 52a339d9eSKonstantin Belousov.\" Konstantin Belousov <kib@FreeBSD.org> under sponsorship 62a339d9eSKonstantin Belousov.\" from the FreeBSD Foundation. 72a339d9eSKonstantin Belousov.\" 82a339d9eSKonstantin Belousov.\" Redistribution and use in source and binary forms, with or without 92a339d9eSKonstantin Belousov.\" modification, are permitted provided that the following conditions 102a339d9eSKonstantin Belousov.\" are met: 112a339d9eSKonstantin Belousov.\" 1. Redistributions of source code must retain the above copyright 122a339d9eSKonstantin Belousov.\" notice, this list of conditions and the following disclaimer. 132a339d9eSKonstantin Belousov.\" 2. Redistributions in binary form must reproduce the above copyright 142a339d9eSKonstantin Belousov.\" notice, this list of conditions and the following disclaimer in the 152a339d9eSKonstantin Belousov.\" documentation and/or other materials provided with the distribution. 162a339d9eSKonstantin Belousov.\" 172a339d9eSKonstantin Belousov.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND 182a339d9eSKonstantin Belousov.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 192a339d9eSKonstantin Belousov.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 202a339d9eSKonstantin Belousov.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE 212a339d9eSKonstantin Belousov.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 222a339d9eSKonstantin Belousov.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 232a339d9eSKonstantin Belousov.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 242a339d9eSKonstantin Belousov.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 252a339d9eSKonstantin Belousov.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 262a339d9eSKonstantin Belousov.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 272a339d9eSKonstantin Belousov.\" SUCH DAMAGE. 282a339d9eSKonstantin Belousov.\" 292a339d9eSKonstantin Belousov.\" $FreeBSD$ 302a339d9eSKonstantin Belousov.\" 31*1fdf757cSEnji Cooper.Dd March 27, 2017 322a339d9eSKonstantin Belousov.Dt PTHREAD_MUTEX_CONSISTENT 3 332a339d9eSKonstantin Belousov.Os 342a339d9eSKonstantin Belousov.Sh NAME 352a339d9eSKonstantin Belousov.Nm pthread_mutex_consistent 362a339d9eSKonstantin Belousov.Nd mark state protected by robust mutex as consistent 372a339d9eSKonstantin Belousov.Sh LIBRARY 382a339d9eSKonstantin Belousov.Lb libpthread 392a339d9eSKonstantin Belousov.Sh SYNOPSIS 402a339d9eSKonstantin Belousov.In pthread.h 412a339d9eSKonstantin Belousov.Ft int 422a339d9eSKonstantin Belousov.Fn pthread_mutex_consistent "pthread_mutex_t *mutex" 432a339d9eSKonstantin Belousov.Sh DESCRIPTION 442a339d9eSKonstantin BelousovIf the thread owning a robust mutex terminates while holding the 452a339d9eSKonstantin Belousovmutex, the mutex becomes inconsistent and the next thread that 462a339d9eSKonstantin Belousovacquires the mutex lock is notified of the state by the return value 472a339d9eSKonstantin Belousov.Er EOWNERDEAD . 482a339d9eSKonstantin BelousovIn this case, the mutex does not become normally usable again until 492a339d9eSKonstantin Belousovthe state is marked consistent. 502a339d9eSKonstantin Belousov.Pp 512a339d9eSKonstantin BelousovThe 522a339d9eSKonstantin Belousov.Fn pthread_mutex_consistent , 532a339d9eSKonstantin Belousovwhen called with the 542a339d9eSKonstantin Belousov.Fa mutex 552a339d9eSKonstantin Belousovargument, which points to the initialized robust mutex in an 562a339d9eSKonstantin Belousovinconsistent state, marks the by mutex as consistent again. 572a339d9eSKonstantin BelousovThe consequent unlock of the mutex, by either 582a339d9eSKonstantin Belousov.Fn pthread_mutex_unlock 592a339d9eSKonstantin Belousovor other methods, allows other contenders to lock the mutex. 602a339d9eSKonstantin Belousov.Pp 612a339d9eSKonstantin BelousovIf the mutex in the inconsistent state is not marked consistent 622a339d9eSKonstantin Belousovby the call to 632a339d9eSKonstantin Belousov.Fn pthread_mutex_consistent 642a339d9eSKonstantin Belousovbefore unlock, 652a339d9eSKonstantin Belousovfurther attempts to lock the 662a339d9eSKonstantin Belousov.Fa mutex 672a339d9eSKonstantin Belousovresult in the 682a339d9eSKonstantin Belousov.Er ENOTRECOVERABLE 692a339d9eSKonstantin Belousovcondition reported by the locking functions. 702a339d9eSKonstantin Belousov.Sh RETURN VALUES 712a339d9eSKonstantin BelousovIf successful, 722a339d9eSKonstantin Belousov.Fn pthread_mutex_consistent 732a339d9eSKonstantin Belousovwill return zero, otherwise an error number will be returned to 742a339d9eSKonstantin Belousovindicate the error. 752a339d9eSKonstantin Belousov.Sh ERRORS 762a339d9eSKonstantin BelousovThe 772a339d9eSKonstantin Belousov.Fn pthread_mutex_lock 782a339d9eSKonstantin Belousovfunction will fail if: 792a339d9eSKonstantin Belousov.Bl -tag -width Er 802a339d9eSKonstantin Belousov.It Bq Er EINVAL 812a339d9eSKonstantin BelousovThe mutex pointed to by the 822a339d9eSKonstantin Belousov.Fa mutex 832a339d9eSKonstantin Belousovargument is not robust, or is not in the inconsistent state. 842a339d9eSKonstantin Belousov.El 852a339d9eSKonstantin Belousov.Sh SEE ALSO 862a339d9eSKonstantin Belousov.Xr pthread_mutex_init 3 , 872a339d9eSKonstantin Belousov.Xr pthread_mutex_lock 3 , 88*1fdf757cSEnji Cooper.Xr pthread_mutex_unlock 3 , 89*1fdf757cSEnji Cooper.Xr pthread_mutexattr_setrobust 3 902a339d9eSKonstantin Belousov.Sh STANDARDS 912a339d9eSKonstantin BelousovThe 922a339d9eSKonstantin Belousov.Fn pthread_mutex_lock 932a339d9eSKonstantin Belousovfunction conforms to 942a339d9eSKonstantin Belousov.St -susv4 . 95