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