Table of Contents
This is a document of the API for the event handler. The purpose of the event handler is to allow scheduling and serialization of multiple different types of events.
event_handle_t *event_register(event_id_t data, event_type_t type, event_fn_t callback, void *arg);
Sets up an event of the given type to call the given function with the given argument.
The 'data' argument is type specific.
EV_READFD, EV_WRITEFD - the file descriptor to monitor EV_SIG - the signal number to monitor EV_TIME - the number of seconds between each pulse EV_WAIT - the wait identifier used with event_wakeup() EV_DEAD - internal use only
void event_release(event_handle_t *handle);
Remove an event from the queue. This can happen at any time, even while the event is firing.
void event_loop(int dontblock);
Process all pending events. If the argument is zero, this will keep running until all events have been released. If the argument is nonzero, this will do one pass over all pending events, and fire the ones that are immediately ready, and then return.
void event_wait(event_id_t id);
Like event_loop(0), except that it will stop as soon as the event id is serviced.
This is an opaque structure that describes a registered event. It is only useful to keep if you need to unregister the event later.
This is type-specific data. The contents and format depend on on the type of the event. This is an unsigned integral type.
This type of event will fire when the file descriptor passed to event_register has data waiting to be read.
This type of event will fire when the file descriptor passed to event_register can have data written to it without blocking.
This type of event will fire when the signal number passed to event_register has been caught. Note that if a signal is caught while processing is not in event_loop(), the event will be delayed until processing returns to event_loop().
This type of event will fire repeatedly with a delay of the number of seconds passed to event_register between each interval.