From 74a12ffc8b37f2dae4b3002e86f33b8ca52df22d Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Sun, 29 Dec 2019 23:21:33 -0800 Subject: man page updates for 1.2 --- man/v1.2/nng_cv_wait.3supp.html | 631 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 631 insertions(+) create mode 100644 man/v1.2/nng_cv_wait.3supp.html (limited to 'man/v1.2/nng_cv_wait.3supp.html') diff --git a/man/v1.2/nng_cv_wait.3supp.html b/man/v1.2/nng_cv_wait.3supp.html new file mode 100644 index 00000000..117f61b2 --- /dev/null +++ b/man/v1.2/nng_cv_wait.3supp.html @@ -0,0 +1,631 @@ +--- +version: 1.2 +layout: refman +--- + + + + + + + +nng_cv_wait(3supp) + + + + + + + +
+
+

SYNOPSIS

+
+
+
+
#include <nng/nng.h>
+#include <nng/supplemental/util/platform.h>
+
+void nng_cv_wait(nng_cv *cv);
+
+
+
+
+
+

DESCRIPTION

+
+
+

The nng_cv_wait() waits for the condition variable cv to be signaled +by another thread calling either nng_cv_wake() or +nng_cv_wake1().

+
+
+

The caller must have have ownership of the mutex that was used when +cv was allocated. +This function will drop the ownership of that mutex, and reacquire it +atomically just before returning to the caller. +(The waiting is done without holding the mutex.)

+
+
+ + + + + +
+ + +Any condition may be used or checked, but the condition must be +checked, as it is possible for this function to wake up “spuriously”. +The best way to do this is inside a loop that repeats until the condition +tests for true. +
+
+
+
+
+

EXAMPLE

+
+
+

The following example demonstrates use of this function:

+
+
+
Example 1: Waiting for the condition
+
+

+    nng_mtx_lock(m);  // assume cv was allocated using m
+    while (!condition_true) {
+        nng_cv_wait(cv);
+    }
+    // condition_true is true
+    nng_mtx_unlock(m);
+
+
+
+
Example 2: Signaling the condition
+
+
    nng_mtx_lock(m);
+    condition_true = true;
+    cv_wake(cv);
+    nng_mtx_unlock(m);
+
+
+
+
+
+

RETURN VALUES

+
+
+

None.

+
+
+
+
+

ERRORS

+
+
+

None.

+
+
+
+ +
+ + -- cgit v1.2.3-70-g09d2