NNG_MTX_ALLOC(3supp)
NNG_MTX_ALLOC(3supp) β allocate mutex β¨
okay so this one is straight out of the NNG Reference Manual, and todayβs main character is nng_mtx_alloc (3supp). bestie, weβre allocating a mutex. itβs giving tiny lock-shaped legend π
πΈ NAME πΈ
nng_mtx_alloc β allocate mutex π
π¦ SYNOPSIS π¦
#include <nng/nng.h>
typedef struct nng_mtx nng_mtx;
int nng_mtx_alloc(nng_mtx **mtxp);
β¨ DESCRIPTION β¨
so the nng_mtx_alloc() function allocates a mutex and hands it back to you in mtxp. iconic behavior, no cap π«Ά
the mutex objects made by this function are suitable only for simple lock and unlock operations, and they are not recursive. like, do not expect them to re-enter themselves, because they will not. every effort has been made to use light-weight underlying primitives when available β lowkey efficient, highkey slay β‘
mutex (mutual exclusion) objects can be thought of as binary semaphores, where only a single thread of execution is permitted to acquire the semaphore. one thread. thatβs the vibe. π
and furthermore: a mutex can only be unlocked by the thread that locked it. periodt. π
π RETURN VALUES π
this function returns 0 on success, and non-zero otherwise. thatβs it, thatβs the whole return-value moment β¨
π ERRORS π
NNG_ENOMEMβ insufficient free memory exists. translation: not enough free memory to make it happen ππ
π SEE ALSO π
nng_cv_alloc(3supp)nng_mtx_free(3supp)nng_mtx_lock(3supp)nng_mtx_unlock(3supp)nng_strerror(3)nng(7)
later bestie π this page is from the NNG Reference Manual, dated 2026-01-13, and the page tag is NNG_MTX_ALLOC(3supp) β go forth and lock responsibly π§ββοΈπΈ
π¦ where this page comes from
- alpine 3.24: nng-doc 1.11-r0 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms