= 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)]
