PTHREAD...SISTENT(3POSIX)
β¨ PROLOG β¨
okay so quick lil heads up bestie π«Ά this manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (so like, go check the corresponding Linux manual page for the deets on Linux behavior), or honestly the interface may just not be implemented on Linux at all. π
π NAME π
pthread_mutex_consistent β mark state protected by robust mutex as consistent
πΈ SYNOPSIS πΈ
#include <pthread.h>
int pthread_mutex_consistent(pthread_mutex_t *mutex);
π¦ DESCRIPTION π¦
So here's the vibe: if mutex is a robust mutex that's currently in an inconsistent state, the pthread_mutex_consistent() function can be used to mark the state protected by the mutex referenced by mutex as consistent again. slay. β¨
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 shall be notified of the state by the return value [EOWNERDEAD]. In this case, the mutex does not become normally usable again until the state is marked consistent. no cap.
If the thread which 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 shall be notified about the state of the mutex by the return value [EOWNERDEAD]. it's giving generational trauma, the [EOWNERDEAD] just keeps getting passed down. π
π¨ The behavior is undefined if the value specified by themutexargument topthread_mutex_consistent()does not refer to an initialized mutex. undefined behavior is not a vibe, bestie, do not do this.
π RETURN VALUE π
Upon successful completion, the pthread_mutex_consistent() function shall return zero. π Otherwise, an error value shall be returned to indicate the error.
π₯ ERRORS π₯
The pthread_mutex_consistent() function shall fail if:
EINVALβ The mutex object referenced bymutexis not robust or does not protect an inconsistent state. π
These functions shall not return an error code of [EINTR].
The following sections are informative.
π EXAMPLES π
None.
like... literally none. the examples said "not me showing up empty-handed." π
π APPLICATION USAGE π
The pthread_mutex_consistent() function is only responsible for notifying the implementation that the state protected by the mutex has been recovered and that normal operations with the mutex can be resumed. It is the responsibility of the application to recover the state so it can be reused. π«Ά
If the application is not able to perform the recovery, it can notify the implementation that the situation is unrecoverable by a call to pthread_mutex_unlock() without a prior call to pthread_mutex_consistent(), in which case subsequent threads that attempt to lock the mutex will fail to acquire the lock and be returned [ENOTRECOVERABLE]. it's giving "we tried, we really did." π
β RATIONALE β
If an implementation detects that the value specified by the mutex argument to pthread_mutex_consistent() does not refer to an initialized mutex, it is recommended that the function should fail and report an [EINVAL] error. π§
πΈ FUTURE DIRECTIONS πΈ
None.
π« SEE ALSO π«
pthread_mutex_lock()pthread_mutexattr_getrobust()
The Base Definitions volume of POSIX.1β2017, <pthread.h>
π COPYRIGHT π
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .
Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .
and that's the whole page bestie, we ate and left no crumbs π
this was brought to you by IEEE/The Open Group back in 2017, filed under PTHREAD...SISTENT(3POSIX), and yeah the title got cut off in the header which is lowkey iconic of it. mwah πβ¨
π¦ where this page comes from
- debian bookworm: manpages-posix-dev 2017a-2 Β· Other
- debian trixie: manpages-posix-dev 2017a-2 Β· Other
- ubuntu jammy: manpages-posix-dev 2017a-2 Β· Other
- ubuntu noble: manpages-posix-dev 2017a-2 Β· Other
- ubuntu resolute: manpages-posix-dev 2017a-2build1 Β· Other
- ubuntu stonking: manpages-posix-dev 2017a-2.1 Β· Other
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms