NNG_CV_ALLOC(3supp)
π NNG_CV_ALLOC(3supp) β allocate condition variable π
okay bestie, welcome to the NNG_CV_ALLOC(3supp) page from the NNG Reference Manual β it's giving βtiny but important,β and we're gonna get you across it. π
β¨ NAME β¨
nng_cv_alloc β allocate condition variable
π«Ά SYNOPSIS π«Ά
#include <nng/nng.h>
typedef struct nng_cv nng_cv;
int nng_cv_alloc(nng_cv **cvp, nng_mtx *mtx);
π DESCRIPTION π
So nng_cv_alloc() allocates a condition variable, uses the mutex mtx, and hands it back to you in cvp. That's the whole assignment, no cap. β¨
Every condition variable is associated with a mutex, bestie β and that mutex must be owned when a thread waits for the condition using nng_cv_wait() or nng_cv_until(). The mutex must also be owned when signaling the condition using the nng_cv_wake() or nng_cv_wake1() functions. π
okay so ownership of that mutex is not optional β it's the main character rule here. π¨
π RETURN VALUES π
This function returns 0 on success, and non-zero otherwise. Slay. β
π ERRORS π
NNG_ENOMEMβ insufficient free memory exists. π
π SEE ALSO π
nng_cv_free(3supp)nng_cv_until(3supp)nng_cv_wait(3supp)nng_cv_wake(3supp)nng_cv_wake1(3supp)nng_mtx_alloc(3supp)nng_strerror(3)nng(7)
and that's the page, bestie πβ¨ β from the NNG Reference Manual, source/version and all, dated 2026-01-13, page NNG_CV_ALLOC(3supp). mwah π
π¦ 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