This graph shows which files directly or indirectly include this file:
Go to the source code of this file.
Defines | |
#define | ELOOP_ALL_CTX (void *) -1 |
eloop_cancel_timeout() magic number to match all timeouts | |
Functions | |
void | eloop_init (void *user_data) |
Initialize global event loop data. | |
int | eloop_register_read_sock (int sock, void(*handler)(int sock, void *eloop_ctx, void *sock_ctx), void *eloop_data, void *user_data) |
Register handler for read events. | |
void | eloop_unregister_read_sock (int sock) |
Unregister handler for read events. | |
int | eloop_register_timeout (unsigned int secs, unsigned int usecs, void(*handler)(void *eloop_ctx, void *timeout_ctx), void *eloop_data, void *user_data) |
Register timeout. | |
int | eloop_cancel_timeout (void(*handler)(void *eloop_ctx, void *sock_ctx), void *eloop_data, void *user_data) |
Cancel timeouts. | |
int | eloop_register_signal (int sig, void(*handler)(int sig, void *eloop_ctx, void *signal_ctx), void *user_data) |
Register handler for signals. | |
void | eloop_run (void) |
Start the event loop. | |
void | eloop_terminate (void) |
Terminate event loop. | |
void | eloop_destroy (void) |
Free any resources allocated for the event loop. | |
int | eloop_terminated (void) |
Check whether event loop has been terminated. |
Alternatively, this software may be distributed under the terms of BSD license.
See README and COPYING for more details.
This file defines an event loop interface that supports processing events from registered timeouts (i.e., do something after N seconds), sockets (e.g., a new packet available for reading), and signals. eloop.c is an implementation of this interface using select() and sockets. This is suitable for most UNIX/POSIX systems. When porting to other operating systems, it may be necessary to replace that implementation with OS specific mechanisms.
Definition in file eloop.h.
|
Cancel timeouts.
|
|
Free any resources allocated for the event loop. After calling eloop_destroy(), other eloop_* functions must not be called before re-running eloop_init(). |
|
Initialize global event loop data.
|
|
Register handler for read events.
|
|
Register handler for signals.
Signals are 'global' events and there is no local eloop_data pointer like with other handlers. The global user_data pointer registered with eloop_init() will be used as eloop_ctx for signal handlers. |
|
Register timeout.
|
|
Start the event loop. Start the event loop and continue running as long as there are any registered event handlers. This function is run after event loop has been initialized with event_init() and one or more events have been registered. |
|
Terminate event loop. Terminate event loop even if there are registered events. This can be used to request the program to be terminated cleanly. |
|
Check whether event loop has been terminated.
|
|
Unregister handler for read events.
|