From 55e98ae58c5856c1808e3fccb2548a76c9b8907c Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Mon, 12 Mar 2018 17:37:33 -0700 Subject: nng_sleep_aio should honor aio timeout. The first problem was that using nng_sleep_aio was found to reset the timeout, and this caused subsequent operations to start failing with timeouts when reusing the AIO for other operations. The second thing is that we think it would be nicer if the presence of real aio timeouts were still honored, so that if the timeout is shorter than the sleep time, then we get back an NNG_ETIMEDOUT like every other operation, and we get back a 0 if the logical sleep operation completes normally. --- docs/man/nng_sleep_aio.adoc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'docs') diff --git a/docs/man/nng_sleep_aio.adoc b/docs/man/nng_sleep_aio.adoc index dff00219..8181046d 100644 --- a/docs/man/nng_sleep_aio.adoc +++ b/docs/man/nng_sleep_aio.adoc @@ -26,12 +26,11 @@ void nng_sleep_aio(nng_duration msec, nng_aio *aio); The `nng_sleep_aio()` function performs an asynchronous "`sleep``", causing the callback for _aio_ to be executed after _msec_ milliseconds. -This is logically the equivalent of starting an asynchronous operation -that does nothing at all, but expires after _msec_ duration, _except_ that -the completion result will be zero rather `NNG_ETIMEDOUT`. +If the sleep finishes completely, the result will always be zero. -NOTE: This overrides and replaces any timeout on the _aio_ set with -<>. +NOTE: If a timeout is set on _aio_ using +<>, and it is shorter than _msec_, +then the sleep will wake up early, with a result code of `NNG_ETIMEDOUT`. == RETURN VALUES -- cgit v1.2.3-70-g09d2