Barrelfish
|
Waitset and low-level event handling mechanism. More...
Data Structures | |
struct | waitset_chanstate |
Per-channel state belonging to waitset. More... | |
struct | waitset |
Wait set. More... | |
Enumerations |
Functions | |
void | poll_channels_disabled (dispatcher_handle_t handle) |
Check polled channels. | |
void | waitset_init (struct waitset *ws) |
Initialise a new waitset. | |
errval_t | waitset_destroy (struct waitset *ws) |
Destroy a previously initialised waitset. | |
errval_t | get_next_event (struct waitset *ws, struct event_closure *retclosure) |
Wait for (block) and return next event on given waitset. More... | |
errval_t | get_next_event_disabled (struct waitset *ws, struct waitset_chanstate **retchan, struct event_closure *retclosure, struct waitset_chanstate *waitfor, struct waitset_chanstate *waitfor2, dispatcher_handle_t handle, bool debug) |
Get next pending event. More... | |
errval_t | event_dispatch (struct waitset *ws) |
Wait for (block) and dispatch next event on given waitset. More... | |
errval_t | wait_for_channel (struct waitset *ws, struct waitset_chanstate *channel, errval_t *error_var) |
Dispatch events until a specific event is received. More... | |
errval_t | event_dispatch_non_block (struct waitset *ws) |
check and dispatch next event on given waitset More... | |
Waitset and low-level event handling mechanism.
enum ws_chanstate |
Current state of a channel on a specific waitset.
enum ws_chantype |
errval_t event_dispatch | ( | struct waitset * | ws | ) |
Wait for (block) and dispatch next event on given waitset.
Wait until something happens, either activity on some channel, or deferred call, and then call the corresponding closure.
ws | Waitset |
errval_t event_dispatch_non_block | ( | struct waitset * | ws | ) |
check and dispatch next event on given waitset
Check if there is any pending activity on some channel, or deferred call, and then call the corresponding closure.
Do not wait! In case of no pending events, return err LIB_ERR_NO_EVENT.
ws | Waitset |
errval_t get_next_event | ( | struct waitset * | ws, |
struct event_closure * | retclosure | ||
) |
Wait for (block) and return next event on given waitset.
Wait until something happens, either activity on some channel, or a deferred call, and then return the corresponding closure. This is the core of the event-handling system.
ws | Waitset |
retclosure | Pointer to storage space for returned event closure |
errval_t get_next_event_disabled | ( | struct waitset * | ws, |
struct waitset_chanstate ** | retchannel, | ||
struct event_closure * | retclosure, | ||
struct waitset_chanstate * | waitfor, | ||
struct waitset_chanstate * | waitfor2, | ||
dispatcher_handle_t | handle, | ||
bool | debug | ||
) |
Get next pending event.
Check if there is a pending event that matches current thread and return it. Pending events are in a pending queue and in a waiting queue. A pending event then will be removed from a pending/waiting queue and become unregistered or, if it's persistent, will be re-registered to an idle queue or a polled queue (UMP channels) of a waitset. If there's no pending event, block this thread. If there's a pending event but it doesn't match our thread, don't remove it from a pending queue and wake up a matching thread. If there's no matching thread, add it to a waiting queue.
ws | Waitset with sources of events |
retchannel | Holder of returned event |
retclosure | Holder of returned closure |
waitfor | Specific event that we're waiting for (can be NULL) |
handle | Dispatcher's handle |
debug | Debug mode (not used) |
errval_t wait_for_channel | ( | struct waitset * | ws, |
struct waitset_chanstate * | waitfor, | ||
errval_t * | error_var | ||
) |
Dispatch events until a specific event is received.
Wait for events and dispatch them. If a specific event comes, don't call a closure, just return.
ws | Waitset |
waitfor | Event, that we are waiting for |
error_var | Error variable that can be changed by closures |