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.
50 When a thread holding an intra-process lock or a process holding an
51 inter-process lock crashes or terminates without unlocking the mutex, then the
54 For another thread or process to obtain the lock, something else must
56 .It Sy PTHREAD_MUTEX_ROBUST
57 The mutex referred to by
59 is considered a robust mutex.
60 When a process holding an inter-process lock crashes or terminates without
61 unlocking the mutex, the attempt to lock it will return
63 This allows the new owner the chance to fix the internal state and call
64 .Xr pthread_mutex_consistent 3C
65 prior to unlocking the lock, allowing normal operation to proceed.
66 Any crashes while in this state cause the next owner to obtain
70 Upon successful completion, the
71 .Fn pthread_mutexattr_getrobust
76 with the current value of the robust attribute.
77 Upon successful completion, the
78 .Fn pthread_mutexattr_setrobust
81 and update the robust property of the attributes pointed to by
85 If either function fails, an error code will be returned to indicate the
87 Valid errors are defined below.
90 .Fn pthread_mutexattr_getrobust
91 function will fail if:
95 is invalid or a null pointer,
101 .Fn pthread_mutexattr_setrobust
102 function will fail if:
106 is invalid or a null pointer,
109 .Sy PTHREAD_MUTEX_STALLED
111 .Sy PTHREAD_MUTEX_ROBUST .
113 .Sh INTERFACE STABILITY
118 .Xr pthread_mutex_consistent 3C ,
120 .Xr libpthread 3LIB ,