summaryrefslogtreecommitdiff
path: root/docs/reference/src/thr/nng_mtx_unlock.md
blob: 60fe2f4f347717f40446bff2448de82c2a7bbcff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# nng_mtx_unlock(3supp)

## NAME

nng_mtx_unlock --- unlock mutex

## SYNOPSIS

```c
#include <nng/nng.h>
#include <nng/supplemental/util/platform.h>

void nng_mtx_unlock(nng_mtx *mtx);
```

## DESCRIPTION

The `nng_mtx_unlock()` relinquishes ownership of the mutex _mtx_ that
was previously acquired via [`nng_mtx_lock()`][nng_mtx_lock].

> [!NOTE]
> A mutex can _only_ be unlocked by the thread that locked it.
> Attempting to unlock a mutex that is not owned by the caller will result
> in undefined behavior.

## SEE ALSO

[nng_mtx_alloc](nng_mtx_alloc),
[nng_mtx_lock](nng_mtx_lock)

{{#include ../refs.md}}