---
name: "nng_sleep_aio"
section: "3"
platform: "linux"
package: "libnng-dev"
version: "1.10.1-2"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/nng_sleep_aio"
---

# nng\_sleep\_aio(3)

sleep asynchronously

## NAME

nng\_sleep\_aio - sleep asynchronously

## SYNOPSIS

```
#include <nng/nng.h>
void nng_sleep_aio(nng_duration msec, nng_aio *aio);
```

## DESCRIPTION

The `nng_sleep_aio()` function provides an asynchronous delay mechanism, causing the callback for *aio* to be executed after *msec* milliseconds. If the sleep finishes completely, the result will always be zero.

**Note**\

If a timeout is set on *aio* using `nng_aio_set_timeout()`, and it is shorter than *msec*, then the sleep will wake up early, with a result code of `NNG_ETIMEDOUT`.

## RETURN VALUES

None.

## ERRORS

None.

## SEE ALSO

[nng\_aio\_abort(3)](/nng_aio_abort/3.md), [nng\_aio\_alloc(3)](/nng_aio_alloc/3.md), [nng\_aio\_set\_timeout(3)](/nng_aio_set_timeout/3.md), [nng\_strerror(3)](/nng_strerror/3.md), [nng\_aio(5)](/nng_aio/5.md), [nng\_duration(5)](/nng_duration/5.md), [nng(7)](/nng/7.md)
