Libevent
Introduction
libevent is a software library that provides asynchronous event notification. The libevent API provides a mechanism to execute a callback function when a specific event occurs on a file descriptor or after a timeout has been reached. Furthermore, libevent also support callbacks due to signals or regular timeouts.
Table of Contents
API
Loop
Start Loop
int event_base_loop(struct event_base *base, int flags);
int event_base_dispatch(struct event_base *base);
keeps running until there are no more registered events or until event_base_loopbreak() or event_base_loopexit() is called.
Stop Loop
int event_base_loopexit(struct event_base *base, const struct timeval *tv);
int event_base_loopbreak(struct event_base *base);
Loop End Reason
int event_base_got_exit(struct event_base *base);
int event_base_got_break(struct event_base *base);
Continue Loop
int event_base_loopcontinue(struct event_base *);
Internal Time Cache
int event_base_gettimeofday_cached(struct event_base *base, struct timeval *tv_out);
int event_base_update_cache_time(struct event_base *base);
Status
void event_base_dump_events(struct event_base *base, FILE *f);
Iterate Events
typedef int (*event_base_foreach_event_cb)(const struct event_base *, const struct event *, void *);
int event_base_foreach_event(struct event_base *base, event_base_foreach_event_cb fn, void *arg);