1 PTHREAD_MUTEXATTR_GETROBUST(3C) Standard C Library Functions 2 3 NAME 4 pthread_mutexattr_getrobust, pthread_mutexattr_setrobust - get and set 5 the mutex robust attribute 6 7 SYNOPSIS 8 #include <pthread.h> 9 10 int 11 pthread_mutexattr_getrobust(const pthread_mutexattr_t *attr, 12 int *robust); 13 14 int 15 pthread_mutexattr_setrobust(pthread_mutexattr_t *attr, int robust); 16 17 DESCRIPTION 18 The pthread_mutexattr_getrobust() and pthread_mtuexattr_setrobust() 19 functions obtain and set a mutex's robust attribute, putting it in, or 20 obtaining it from robust. The valid values for robust include: 21 22 PTHREAD_MUTEX_STALLED 23 The mutex referred to by attr is a traditional mutex. When 24 a thread holding an intra-process lock or a process holding 25 an inter-process lock crashes or terminates without 26 unlocking the mutex, then the lock will be stalled. For 27 another thread or process to obtain the lock, something 28 else must unlock it. 29 30 PTHREAD_MUTEX_ROBUST 31 The mutex referred to by attr is considered a robust mutex. 32 When a process holding an inter-process lock crashes or 33 terminates without unlocking the mutex, the attempt to lock 34 it will return EOWNERDEAD. This allows the new owner the 35 chance to fix the internal state and call 36 pthread_mutex_consistent(3C) prior to unlocking the lock, 37 allowing normal operation to proceed. Any crashes while in 38 this state cause the next owner to obtain EOWNERDEAD. 39 40 RETURN VALUES 41 Upon successful completion, the pthread_mutexattr_getrobust() function 42 will return 0 and update robust with the current value of the robust 43 attribute. Upon successful completion, the pthread_mutexattr_setrobust() 44 function will return 0 and update the robust property of the attributes 45 pointed to by attr to robust. If either function fails, an error code 46 will be returned to indicate the error. Valid errors are defined below. 47 48 ERRORS 49 The pthread_mutexattr_getrobust() function will fail if: 50 51 EINVAL attr is invalid or a null pointer, robust is a null 52 pointer. 53 54 The pthread_mutexattr_setrobust() function will fail if: 55 56 EINVAL attr is invalid or a null pointer, robust is not one 57 of PTHREAD_MUTEX_STALLED or PTHREAD_MUTEX_ROBUST. 58 59 INTERFACE STABILITY 60 Committed 61 62 MT-LEVEL 63 MT-Safe 64 65 SEE ALSO 66 pthread_mutex_consistent(3C), pthread(3HEAD), libpthread(3LIB), 67 attributes(5), mutex(5) 68 69 illumos August 20, 2019 illumos