table of contents
RUNTIME_WAIT(3) | MINIASYNC Programmer's Manual | RUNTIME_WAIT(3) |
NAME¶
runtime_wait(), runtime_wait_multiple() - wait for the completion of single or multiple futures
SYNOPSIS¶
-
#include <libminiasync.h> struct future {
future_task_fn task;
struct future_context context; }; struct runtime; void runtime_wait(struct runtime *runtime, struct future *fut); void runtime_wait_multiple(struct runtime *runtime, struct future *futs[],
size_t nfuts);
For general description of runtime API, see miniasync_runtime(7).
DESCRIPTION¶
The runtime_wait() function blocks the calling thread until the future structure pointed by fut completes. While waiting the calling thread repeatedly polls the future with future_poll(3) function until completion.
The runtime_wait_multiple() function works similar to the runtime_wait() function, additionally it facilitates polling of multiple futures in an array. runtime_wait_multiple() function uniformly polls the first nfuts futures in the array pointed by futs until all of them complete execution. Runtime execution can be influenced by future properties. For more information about the future properties, see miniasync_future(7).
Properties, which affect runtime: * FUTURE_PROPERTY_ASYNC property should be applied to asynchronous futures. During runtime_wait_multiple() function, asynchronous futures have a priority over the synchronous ones and, in general, are being polled first.
miniasync(7) runtime implementation makes use of the waker notifier feature to optimize future polling. For more information about the waker feature, see miniasync_future(7).
RETURN VALUE¶
The runtime_wait() function returns a pointer to a new runtime structure.
The runtime_wait_multiple() function does not return any value.
SEE ALSO¶
future_poll(3), miniasync(7), miniasync_future(7) miniasync_runtime(7) and <https://pmem.io>
2022-09-04 | MINIASYNC - miniasync version 0.2.1 |