aura
0.1
|
Macros | |
#define | aura_eventloop_create(...) aura_eventloop_create__(0, ##__VA_ARGS__, NULL) |
Functions | |
void | aura_eventloop_add (struct aura_eventloop *loop, struct aura_node *node) |
void | aura_eventloop_del (struct aura_node *node) |
void * | aura_eventloop_create_empty () |
void * | aura_eventloop_vcreate (va_list ap) |
void * | aura_eventloop_create__ (int dummy,...) |
void | aura_eventloop_destroy (struct aura_eventloop *loop) |
void | aura_handle_events_forever (struct aura_eventloop *loop) |
void | aura_handle_events (struct aura_eventloop *loop) |
void | aura_handle_events_timeout (struct aura_eventloop *loop, int timeout_ms) |
void | aura_eventloop_break (struct aura_eventloop *loop) |
This group functions related to aura event loop. By default aura comes with a simple and easy to use event loop that can aggregate and dispatch events for several nodes. To use it, you should first create an event loop with aura_eventloop_create() from one or more open nodes. Once done, You can call aura_handle_events() and aura_handle_events_timeouts()
Rule of thumb for multi-threading: No more than one thread per node.
#define aura_eventloop_create | ( | ... | ) | aura_eventloop_create__(0, ##__VA_ARGS__, NULL) |
Create an eventloop from one or more nodes. e.g. aura_eventloop_create(node1, node2, node3);
... | one or more struct aura_node* |
void aura_eventloop_add | ( | struct aura_eventloop * | loop, |
struct aura_node * | node | ||
) |
Add a node to existing event loop.
WARNING: This node should not be registered in any other manually created event loops or a panic will occur.
loop | |
node |
Definition at line 38 of file eventloop.c.
References aura_eventloop_destroy(), aura_eventloop_get_data(), and aura_fd_changed_cb().
Referenced by aura_eventloop_vcreate().
void aura_eventloop_break | ( | struct aura_eventloop * | loop | ) |
Interrupt a running event loop. This function can be called from the callbacks.
loop |
Definition at line 244 of file eventloop.c.
void* aura_eventloop_create__ | ( | int | dummy, |
... | |||
) |
Create an event loop from a list of null-terminated nodes. Do not use this function. See aura_eventloop_create() macro
dummy | a dummy parameter required by va_start |
... | A NULL-terminated list of nodes |
Definition at line 151 of file eventloop.c.
References aura_eventloop_vcreate().
void* aura_eventloop_create_empty | ( | ) |
Create an empty eventloop with no nodes
Definition at line 101 of file eventloop.c.
Referenced by aura_eventloop_vcreate().
void aura_eventloop_del | ( | struct aura_node * | node | ) |
Remove a node from it's associated event loop.
WARNING: If the node is not bound to any event loop a panic will occur
loop | |
node |
Definition at line 69 of file eventloop.c.
References aura_eventloop_get_data(), and aura_fd_changed_cb().
Referenced by aura_close(), and aura_eventloop_destroy().
void aura_eventloop_destroy | ( | struct aura_eventloop * | loop | ) |
Destroy and eventloop and deassociate any nodes from it.
loop |
Definition at line 166 of file eventloop.c.
References aura_eventloop_del().
Referenced by aura_close(), and aura_eventloop_add().
void* aura_eventloop_vcreate | ( | va_list | ap | ) |
Create an event loop from a NULL-terminated list of nodes passed in va_list
ap |
Definition at line 128 of file eventloop.c.
References aura_eventloop_add(), and aura_eventloop_create_empty().
Referenced by aura_eventloop_create__().
void aura_handle_events | ( | struct aura_eventloop * | loop | ) |
Handle events in the specified loop for a default timeout or until aura_eventloop_break()
loop |
Definition at line 201 of file eventloop.c.
References aura_handle_events_timeout().
Referenced by aura_core_call(), aura_get_next_event(), and aura_wait_status().
void aura_handle_events_forever | ( | struct aura_eventloop * | loop | ) |
Handle events in the specified loop forever or until someone calls aura_eventloop_break()
loop |
Definition at line 187 of file eventloop.c.
References aura_handle_events_timeout().
void aura_handle_events_timeout | ( | struct aura_eventloop * | loop, |
int | timeout_ms | ||
) |
Wait and handle an event in the specified loop and return or just wait until a timeout occurs.
timeout_ms equal to 0 makes this function non-blocking
timeout_ms equal to -1 makes thsi function idential to aura_handle_events()
loop | |
timeout_ms |
Definition at line 217 of file eventloop.c.
References aura_buffer_destroy(), and aura_buffer::qentry.
Referenced by aura_handle_events(), and aura_handle_events_forever().