summaryrefslogtreecommitdiff
path: root/docs/ref/aio/nng_sleep_aio.adoc
blob: f2ecd288b95cec4168a59b8de00eeade3638cf86 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
## nng_sleep_aio

Sleep asynchronously.

### Synopsis

```c
#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.

### Errors

[horizontal]
`NNG_ETIMEDOUT`:: The sleep was interrupted by a timeout.footnote:[This seemingly paradoxical situation happens if the _aio_ has a timeout set with xref:nng_aio_set_timeout.adoc[`nng_aio_set_timeout`] that is shorter than _msec_.]
`NNG_ECANCELED`:: The operation was canceled.

### See Also

xref:nng_aio_abort.adoc[nng_aio_abort],
xref:nng_aio_set_timeout.adoc[nng_aio_set_timeout]