Updated: April 19, 2023 |
Mark as consistent the state that's protected by a mutex
#include <stdlib.h> int pthread_mutex_consistent( pthread_mutex_t *mutex);
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
If mutex is a robust mutex in an inconsistent state, you can use pthread_mutex_consistent() to mark the state protected by the mutex as consistent again. The behavior is undefined if the value specified by mutex argument doesn't refer to an initialized mutex.
If an owner of a robust mutex terminates while holding the mutex, the mutex becomes inconsistent, and the next thread that acquires the mutex lock is notified of the state by a return value EOWNERDEAD from pthread_mutex_lock(), pthread_mutex_timedlock(), or pthread_mutex_trylock(), In this case, the mutex doesn't become normally usable again until the state is marked as consistent.
If the thread that acquired the mutex lock with the return value EOWNERDEAD terminates before calling either pthread_mutex_consistent() or pthread_mutex_unlock(), the next thread that acquires the mutex lock is notified about the state of the mutex by the return value EOWNERDEAD.
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | No |
Signal handler | Yes |
Thread | No |