PTHREAD_MUTEXATTR_GETROBUST(3C) Standard C Library Functions PTHREAD_MUTEXATTR_GETROBUST(3C)

pthread_mutexattr_getrobust, pthread_mutexattr_setrobustget and set the mutex robust attribute

#include <pthread.h>

int
pthread_mutexattr_getrobust(const pthread_mutexattr_t *attr, int *robust);

int
pthread_mutexattr_setrobust(pthread_mutexattr_t *attr, int robust);

The () and () functions obtain and set a mutex's attribute, putting it in, or obtaining it from robust. The valid values for robust include:

The mutex referred to by attr is a traditional mutex. When a thread holding an intra-process lock or a process holding an inter-process lock crashes or terminates without unlocking the mutex, then the lock will be . For another thread or process to obtain the lock, something else must unlock it.
The mutex referred to by attr is considered a robust mutex. When a process holding an inter-process lock crashes or terminates without unlocking the mutex, the attempt to lock it will return EOWNERDEAD. This allows the new owner the chance to fix the internal state and call pthread_mutex_consistent(3C) prior to unlocking the lock, allowing normal operation to proceed. Any crashes while in this state cause the next owner to obtain EOWNERDEAD.

Upon successful completion, the pthread_mutexattr_getrobust() function will return 0 and update robust with the current value of the robust attribute. Upon successful completion, the pthread_mutexattr_setrobust() function will return 0 and update the robust property of the attributes pointed to by attr to robust. If either function fails, an error code will be returned to indicate the error. Valid errors are defined below.

The pthread_mutexattr_getrobust() function will fail if:

attr is invalid or a null pointer, robust is a null pointer.

The pthread_mutexattr_setrobust() function will fail if:

attr is invalid or a null pointer, robust is not one of PTHREAD_MUTEX_STALLED or PTHREAD_MUTEX_ROBUST.

pthread_mutex_consistent(3C), pthread(3HEAD), libpthread(3LIB), attributes(7), mutex(7)

November 8, 2020 OmniOS