pthread_mutex_consistent(3)

pthread_mutex_consistent3

Mark state protected by robust mutex as consistent

Usage

#include <pthread.h>

int

pthread_mutex_consistent(pthread_mutex_t *mutex);

Library

POSIX Threads Library (libpthread, -lpthread)

Overview

If the process containing the thread owning 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 the return value EOWNERDEAD. In this case, the mutex does not become normally usable again until the state is marked consistent.

The pthread_mutex_consistent(), when called with the mutex argument, which points to the initialized robust mutex in an inconsistent state, marks the mutex as consistent again. The consequent unlock of the mutex, by either pthread_mutex_unlock() or other methods, allows other contenders to lock the mutex.

If the mutex in the inconsistent state is not marked consistent by the call to pthread_mutex_consistent() before unlock, further attempts to lock the mutex result in the ENOTRECOVERABLE condition reported by the locking functions.

Return values

If successful, pthread_mutex_consistent() will return zero, otherwise an error number will be returned to indicate the error.

Errors

The pthread_mutex_lock() function will fail if:

[EINVAL]

The mutex pointed to by the mutex argument is not robust, or is not in the inconsistent state.

Releases

25 releases since FreeBSD 11.0-RELEASE; the text changed 13 times.

  1. 11.0
  2. 11.1
  3. 11.2
  4. 11.3
  5. 11.4
  6. 12.0
  7. 12.1
  8. 12.2
  9. 12.3
  10. 12.4
  11. 13.0–13.2
  12. 13.3–14.2
  13. 14.3–15.1
  14. 16.0

Standards

The pthread_mutex_lock() function conforms to Version 4 of the Single UNIX Specification (“SUSv4”).

From base 16.0-CURRENT-20261027-61c70dc16a79 in FreeBSD 16.0-CURRENT (2026-10-27). Parsed by carta from the page's mdoc source.