From 722bf4621703ef238fa81018f8c3e68bcef91354 Mon Sep 17 00:00:00 2001
From: Garrett D'Amore <garrett@damore.org>
Date: Mon, 18 Apr 2022 10:25:03 -0400
Subject: fixes #1574 Non-blocking version of nng_aio_wait / nng_aio_result

This introduces a new API, nng_aio_busy(), that can be used
to query the status of the aio without blocking.

Some minor documentation fixes are included.
---
 docs/man/nng_aio_busy.3.adoc | 56 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 56 insertions(+)
 create mode 100644 docs/man/nng_aio_busy.3.adoc

(limited to 'docs/man/nng_aio_busy.3.adoc')

diff --git a/docs/man/nng_aio_busy.3.adoc b/docs/man/nng_aio_busy.3.adoc
new file mode 100644
index 00000000..4aaf09b5
--- /dev/null
+++ b/docs/man/nng_aio_busy.3.adoc
@@ -0,0 +1,56 @@
+= nng_aio_busy(3)
+//
+// Copyright 2022 Staysail Systems, Inc. <info@staysail.tech>
+//
+// This document is supplied under the terms of the MIT License, a
+// copy of which should be located in the distribution where this
+// file was obtained (LICENSE.txt).  A copy of the license may also be
+// found online at https://opensource.org/licenses/MIT.
+//
+
+== NAME
+
+nng_aio_busy - test if asynchronous I/O is busy
+
+== SYNOPSIS
+
+[source, c]
+----
+#include <nng/nng.h>
+
+bool nng_aio_busy(nng_aio *aio);
+----
+
+== DESCRIPTION
+
+The `nng_aio_busy()` function returns true if the
+_aio_ is currently busy performing an asynchronous I/O
+operation or is executing a completion callback.
+
+If no operation has been started, or the operation has
+been completed or canceled, and any callback has been
+executed, then it returns false.
+
+This is the same test used internally by
+xref:nng_aio_wait.3.adoc[`nng_aio_wait()`]
+
+NOTE: Care should be taken to ensure that the _aio_ object is not
+freed when using this function.  The caller is responsible for
+coordinating any use of this with any reuse of the _aio_.
+
+== RETURN VALUES
+
+True if the _aio_ is busy, false otherwise.
+
+== ERRORS
+
+None.
+
+== SEE ALSO
+
+[.text-left]
+xref:nng_aio_abort.3.adoc[nng_aio_abort(3)],
+xref:nng_aio_alloc.3.adoc[nng_aio_alloc(3)],
+xref:nng_aio_wait.3.adoc[nng_aio_wait(3)],
+xref:nng_aio.5.adoc[nng_aio(5)],
+xref:nng.7.adoc[nng(7)]
-- 
cgit v1.2.3-70-g09d2

