NNG_CV_ALLOC(3supp)

πŸ“¦ version 1.11, in alpine 3.24

πŸŽ€ 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 πŸ‘€


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