description | eventxx is a simple, direct, one-header inline C++ wrapper for libevent. |
homepage URL | http://proj.llucax.com.ar/embedded/eventxx |
owner | llucax@gmail.com |
last change | Thu, 17 Jan 2008 19:25:57 +0000 (17 17:25 -0200) |
URL | git://repo.or.cz/eventxx.git |
https://repo.or.cz/eventxx.git | |
push URL | ssh://repo.or.cz/eventxx.git |
https://repo.or.cz/eventxx.git (learn more) | |
bundle info | eventxx.git downloadable bundles |
content tags |
libevent is a popular API that 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.
eventxx is a simple, direct, one-header inline C++ wrapper for libevent. Yes, it's just one header file, so if you want to use it you can just copy the file to your project and you are set (well, you'll need to link to libevent too ;).
It's designed to be as close to use to libevent (without compromising modern C++ programming techniques) and efficient as possible (since all implementation is trivial and inline, theoretically, it imposes no overhead at all).
Please, visit the eventxx website for the latest version of this documentation.
Example
#include <eventxx> #include <iostream> #include <csignal> struct handler { eventxx::dispatcher& d; int i; handler(eventxx::dispatcher& d): d(d), i(0) {} void operator() (int signum, eventxx::type event) { std::cout << ++i << " interrupts, "; if (i < 5) std::cout << "keep going...\n"; else { std::cout << "done!\n"; d.exit(); } } }; void timer_handler(int, short, void*) { std::cout << "Press Ctrl-C 5 times to quit.\n"; } int main() { eventxx::dispatcher d; handler h(d); eventxx::ctimer t(timer_handler); eventxx::signal< handler > e(SIGINT, h); d.eventxx::time(1)); // 1 second d.add(e); d.dispatch(); return 0; }
16 years ago | 1.0 | commitlog | ||
16 years ago | 0.7 | commitlog | ||
16 years ago | 0.6 | 0.6 | tag | commitlog |
16 years ago | 0.5 | 0.5 | tag | commitlog |
16 years ago | 0.4 | 0.4 | tag | commitlog |
16 years ago | 0.3 | 0.3 | tag | commitlog |
16 years ago | 0.2 | 0.2 | tag | commitlog |
16 years ago | 0.1 | 0.1 | tag | commitlog |
16 years ago | darcs_import | commitlog |
16 years ago | master | logtree |
16 years ago | mob | logtree |
eventxx/ioevent.git | I/O events, in style of ev++.h, for libev... | chris.brody@gmail.com | 16 years ago | summarylogtree |