Adelsbach Enhanced Threading Library

Manual Pages (DD-00013-001)

Enhanced Threading Library > mtx_unlock (3)
HTML TXT PDF PS
mtx_unlock(3) Library Functions Manual mtx_unlock(3)

mtx_unlockunlocks a previously acquired mutex

library “threads”
#include <threads.h>

int
mtx_unlock(mtx_t *mtx);

The function () will unlock a previously acquired mutex mtx.

A thread can only unlock a mutex if it has been acquired by that thread before.

If recursive mutex acquisition is enabled and the mutex has been acquired by the same thread multiple times () needs to be called from that thread an equal number of times before any other thread can acquire the mutex.

Upon success mtx_unlock() returns thrd_success, in the case of an error thrd_error will be returned.

mtx_init(3) mtx_lock(3) mtx_timedlock(3) mtx_trylock(3) mtx_destroy(3)

The mtx_unlock() function first appeared in the C11 standard ISO/IEC 9899:2011.

Jan Adelsbach <jan@jadelsbach.de>

May 9, 2020 Debian