2 .\" This file and its contents are supplied under the terms of the
3 .\" Common Development and Distribution License ("CDDL"), version 1.0.
4 .\" You may only use this file in accordance with the terms of version
7 .\" A full copy of the text of the CDDL should have accompanied this
8 .\" source. A copy of the CDDL is also available via the Internet at
9 .\" http://www.illumos.org/license/CDDL.
12 .\" Copyright (c) 2014, Joyent, Inc.
15 .Dt PTHREAD_MUTEXATTR_GETROBUST 3C
18 .Nm pthread_mutexattr_getrobust ,
19 .Nm pthrad_mutexattr_setrobust
20 .Nd get and set the mutex robust attribute
24 .Fo pthread_mutexattr_getrobust
25 .Fa "const pthread_mutexattr_t *attr"
29 .Fo pthread_mutexattr_setrobust
30 .Fa "pthread_mutexattr_t *attr"
35 .Fn pthread_mutexattr_getrobust
37 .Fn pthread_mtuexattr_setrobust
38 functions obtain and set a mutex's
40 attribute, putting it in, or obtaining it from
46 .It Sy PTHREAD_MUTEX_STALLED
47 The mutex referred to by
49 is a traditional mutex. When a thread holding an intra-process lock or a
50 process holding an inter-process lock crashes or terminates without
51 unlocking the mutex, then the lock will be
53 For another thread or process to obtain the lock, something else must
55 .It Sy PTHREAD_MUTEX_ROBUST
56 The mutex referred to by
58 is considered a robust mutex. When a process holding an inter-process
59 lock crashes or terminates without unlocking the mutex, the attempt to
62 This allows the new owner the chance to fix the internal state and call
63 .Xr pthread_mutex_consistent 3C
64 prior to unlocking the lock, allowing normal operation to proceed. Any
65 crashes while in this state cause the next owner to obtain
69 Upon successful completion, the
70 .Fn pthread_mutexattr_getrobust
75 with the current value of the robust attribute. Upon successful
77 .Fn pthread_mutexattr_setrobust
80 and update the robust property of the attributes pointed to by
84 If either function fails, an error code will be returned to indicate the
85 error. Valid errors are defined below.
88 .Fn pthread_mutexattr_getrobust
89 function will fail if:
93 is invalid or a null pointer,
99 .Fn pthread_mutexattr_setrobust
100 function will fail if:
104 is invalid or a null pointer,
107 .Sy PTHREAD_MUTEX_STALLED
109 .Sy PTHREAD_MUTEX_ROBUST .
111 .Sh INTERFACE STABILITY
116 .Xr pthread_mutex_consistent 3C ,
118 .Xr libpthread 3LIB ,