#include <sys/types.h>
Go to the source code of this file.
Defines | |
| #define | MSEC (1) |
| #define | SECONDS (1000*MSEC) |
| #define | MINUTES (60*SECONDS) |
| #define | ESECONDS (1) |
| #define | EMINUTES (60*ESECONDS) |
| #define | EHOURS (60*EMINUTES) |
| #define | EDAYS (24*EHOURS) |
| #define | TIMEOUT_DEF (60*SECONDS) |
Typedefs | |
| typedef unsigned int | input_id |
| typedef unsigned int | timer_id |
| typedef void(* | InputCallback )(int fd, input_id id, void *udata) |
| typedef BOOL(* | TimerCallback )(void *udata) |
Enumerations | |
| enum | InputState { INPUT_READ = 0x01, INPUT_WRITE = 0x02, INPUT_ERROR = 0x04 } |
Functions | |
| EXTERN_C_BEGIN LIBGIFT_EXPORT void | event_init (void) |
| LIBGIFT_EXPORT void | event_quit (int sig) |
| LIBGIFT_EXPORT void | event_poll_once (void) |
| LIBGIFT_EXPORT void | event_loop (void) |
| LIBGIFT_EXPORT input_id | input_add (int fd, void *udata, InputState state, InputCallback callback, time_t timeout) |
| LIBGIFT_EXPORT void | input_remove (input_id id) |
| LIBGIFT_EXPORT void | input_remove_all (int fd) |
| LIBGIFT_EXPORT void | input_suspend_all (int fd) |
| LIBGIFT_EXPORT void | input_resume_all (int fd) |
| LIBGIFT_EXPORT timer_id | timer_add (time_t interval, TimerCallback callback, void *udata) |
| LIBGIFT_EXPORT void | timer_reset (timer_id id) |
| LIBGIFT_EXPORT void | timer_remove (timer_id id) |
| LIBGIFT_EXPORT void | timer_remove_zero (timer_id *id) |
Provides the low-level framework for giFT file descriptor (yes, that includes sockets) handling.
|
|
Input handle |
|
|
Callback used to indicate that the connection has changed state according to the input_add state. |
|
|
Timer handle |
|
|
Timer has reached zero.
|
|
|
Available select sets. |
|
|
Initialize the event subsystem. This is mandatory and must be called prior to any events being scheduled into the main loop. |
|
|
Begin the main event loop. This will block until there are no fds or timers remaining or until event_quit has been called. |
|
|
Execute a single blocking poll and handle exactly one event. |
|
|
Clear all events and return from the main loop. This will not exit your program, merely break out of event_loop, which should be the core blocking entity.
|
|
||||||||||||||||||||||||
|
Add a new fd input.
|
|
|
Remove a single input by it's unique identifier. |
|
|
Remove all inputs registered from a single file descriptor. This is useful when you want to lazily clean up all your slop, as giFT certainly desires. The usage of this function is highly discouraged unless you know that the socket is no longer connected as it will interfere with queue systems. |
|
|
Move the inputs back into the select loop. See input_suspend_all. |
|
|
Suspend all inputs registered to this connection from the select loop. This is useful for bandwidth throttling in user space and some other evil things. |
|
||||||||||||||||
|
Install a new timer event.
|
|
|
Remove a timer. This clears all data associated with the timer. The callback will not be raised. |
|
|
Wrapper for timer_remove which assigns the value at id to zero after removal to invalidate the identifier. |
|
|
Reset a timer. That is, reset the expiration time to now + interval as if the timer was registered for the first time. |
1.3.7