Skip to content

Commit

Permalink
docs: update nng_sleep_aio for mdbook
Browse files Browse the repository at this point in the history
  • Loading branch information
gdamore committed Oct 27, 2024
1 parent 2ac729f commit 8e2a094
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 77 deletions.
34 changes: 17 additions & 17 deletions docs/man/libnng.3.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -158,30 +158,30 @@ Only a single asynchronous operation may be associated with an
The following functions are used in the asynchronous model:

|===
|xref:nng_aio_abort.3.adoc[nng_aio_abort()]|abort asynchronous I/O operation
|xref:nng_aio_alloc.3.adoc[nng_aio_alloc()]|allocate asynchronous I/O handle
// |xref:nng_aio_abort.3.adoc[nng_aio_abort()]|abort asynchronous I/O operation
// |xref:nng_aio_alloc.3.adoc[nng_aio_alloc()]|allocate asynchronous I/O handle
|xref:nng_aio_begin.3.adoc[nng_aio_begin()]|begin asynchronous I/O operation
|xref:nng_aio_busy.3.adoc[nng_aio_busy()]|test if asynchronous I/O is busy
|xref:nng_aio_cancel.3.adoc[nng_aio_cancel()]|cancel asynchronous I/O operation
|xref:nng_aio_count.3.adoc[nng_aio_count()]|return number of bytes transferred
// |xref:nng_aio_busy.3.adoc[nng_aio_busy()]|test if asynchronous I/O is busy
// |xref:nng_aio_cancel.3.adoc[nng_aio_cancel()]|cancel asynchronous I/O operation
// |xref:nng_aio_count.3.adoc[nng_aio_count()]|return number of bytes transferred
|xref:nng_aio_defer.3.adoc[nng_aio_defer()]|defer asynchronous I/O operation
|xref:nng_aio_finish.3.adoc[nng_aio_finish()]|finish asynchronous I/O operation
|xref:nng_aio_free.3.adoc[nng_aio_free()]|free asynchronous I/O handle
// |xref:nng_aio_free.3.adoc[nng_aio_free()]|free asynchronous I/O handle
|xref:nng_aio_get_input.3.adoc[nng_aio_get_input()]|return input parameter
|xref:nng_aio_get_msg.3.adoc[nng_aio_get_msg()]|get message from an asynchronous receive
|xref:nng_aio_get_output.3.adoc[nng_aio_get_output()]|return output result
|xref:nng_aio_free.3.adoc[nng_aio_reap()]|reap asynchronous I/O handle
|xref:nng_aio_result.3.adoc[nng_aio_result()]|return result of asynchronous operation
|xref:nng_aio_set_input.3.adoc[nng_aio_set_input()]|set input parameter
|xref:nng_aio_set_iov.3.adoc[nng_aio_set_iov()]|set scatter/gather vector
|xref:nng_aio_set_msg.3.adoc[nng_aio_set_msg()]|set message for an asynchronous send
// |xref:nng_aio_get_msg.3.adoc[nng_aio_get_msg()]|get message from an asynchronous receive
// |xref:nng_aio_get_output.3.adoc[nng_aio_get_output()]|return output result
// |xref:nng_aio_free.3.adoc[nng_aio_reap()]|reap asynchronous I/O handle
// |xref:nng_aio_result.3.adoc[nng_aio_result()]|return result of asynchronous operation
// |xref:nng_aio_set_input.3.adoc[nng_aio_set_input()]|set input parameter
// |xref:nng_aio_set_iov.3.adoc[nng_aio_set_iov()]|set scatter/gather vector
// |xref:nng_aio_set_msg.3.adoc[nng_aio_set_msg()]|set message for an asynchronous send
|xref:nng_aio_set_output.3.adoc[nng_aio_set_output()]|set output result
|xref:nng_aio_set_timeout.3.adoc[nng_aio_set_timeout()]|set asynchronous I/O timeout
|xref:nng_aio_stop.3.adoc[nng_aio_stop()]|stop asynchronous I/O operation
|xref:nng_aio_wait.3.adoc[nng_aio_wait()]|wait for asynchronous I/O operation
// |xref:nng_aio_set_timeout.3.adoc[nng_aio_set_timeout()]|set asynchronous I/O timeout
// |xref:nng_aio_stop.3.adoc[nng_aio_stop()]|stop asynchronous I/O operation
// |xref:nng_aio_wait.3.adoc[nng_aio_wait()]|wait for asynchronous I/O operation
|xref:nng_recv_aio.3.adoc[nng_recv_aio()]|receive message asynchronously
|xref:nng_send_aio.3.adoc[nng_send_aio()]|send message asynchronously
|xref:nng_sleep_aio.3.adoc[nng_sleep_aio()]|sleep asynchronously
// |xref:nng_sleep_aio.3.adoc[nng_sleep_aio()]|sleep asynchronously
|===

=== Protocols
Expand Down
53 changes: 0 additions & 53 deletions docs/man/nng_sleep_aio.3.adoc

This file was deleted.

26 changes: 22 additions & 4 deletions docs/ref/api/time.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Normally durations are positive, but some specific negative values are reserved.
- {{i:`NNG_DURATION_ZERO`}}: A zero length duration is used to performan an immediate
poll.
## Getting the Current Time
## Get the Current Time
```c
nng_time nng_clock(void);
Expand All @@ -55,7 +55,7 @@ The resolution of the clock depends on the underlying timing facilities of the s
This function may be used for timing, but applications should not expect
very fine-grained values.

## Waiting for Duration
## Wait for Duration

```c
void nng_msleep(nng_duration msec);
Expand All @@ -69,9 +69,27 @@ number of milliseconds.
> The actual wait time is determined by the capabilities of the
> underlying system.
## Wait Asynchronously
```c
void nng_sleep_aio(nng_duration msec, nng_aio *aio);
```

It is possible to wait as the action on an [`nng_aio`], which in effect
acts like {{i:scheduling}} a callback to run after a specified period of time.

The {{i:`nng_sleep_aio`}} function provides this capability.
After _msec_ milliseconds have passed, then _aio_'s callback will be executed.
If this sleep waits without interruption, and then completes, the result from
[`nng_aio_result`] will be zero.

> [!NOTE]
> If a timeout shorter than _msec_ is set on _aio_ using [`nng_aio_set_timeout`],
> then the sleep will wake up early, with a result code of [`NNG_ETIMEDOUT`].
## See Also

[`nng_cv_until`],
[`nng_sleep_aio`]
[Asynchronous Operations][aio],
[Synchronization][synchronization]

{{#include ../xref.md}}
6 changes: 3 additions & 3 deletions docs/ref/xref.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
[`nng_strfree`]: /api/memory.md#free-string
[`nng_time`]: /api/time.md#time-type
[`nng_duration`]: /api/time.md#duration-type
[`nng_clock`]: /api/time.md#getting-the-current-time
[`nng_msleep`]: /api/time.md#waiting-for-duration
[`nng_clock`]: /api/time.md#get-the-current-time
[`nng_msleep`]: /api/time.md#wait-for-duration
[`nng_msg`]: /api/msg.md#message-structure
[`nng_msg_alloc`]: /api/msg.md#create-a-message
[`nng_msg_free`]: /api/msg.md#destroy-a-message
Expand Down Expand Up @@ -58,7 +58,7 @@
[`nng_aio`]: /TODO.md
[`nng_aio_alloc`]: /api/aio.md#create-handle
[`nng_aio_free`]: /api/aio.md#destroy-handle
[`nng_sleep_aio`]: /TODO.md
[`nng_sleep_aio`]: /api/time.md@wait-asynchronously
[`nng_aio`]: /api/aio.md#asynchronous-i-o-handle
[`nng_aio_cancel`]: /api/aio.md#cancellation
[`nng_aio_abort`]: /api/aio.md#cancellation
Expand Down

0 comments on commit 8e2a094

Please sign in to comment.