descriptioneventxx is a simple, direct, one-header inline C++ wrapper for libevent.
homepage URLhttp://proj.llucax.com.ar/embedded/eventxx
ownerllucax@gmail.com
last changeThu, 17 Jan 2008 19:25:57 +0000 (17 17:25 -0200)
content tags
add:
readme
NOTE: This repo is mob-enabled.

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;
}

shortlog
2008-01-17 Leandro LucarellaChange version number and update docs about stability.master1.0
2007-11-09 Leandro LucarellaHide dispatcher copy-constructor and operator=.
2007-11-09 Leandro LucarellaDon't do the reinterpret_cast trick anymore for the... mob
2007-11-09 Leandro LucarellaDon't do the reinterpret_cast trick anymore for type...
2007-11-09 Leandro LucarellaUse eventxx constants for dispatch flags in benchmark...
2007-09-24 Leandro LucarellaFixed the main documentation example which was *WRONG*.
2007-09-24 Leandro LucarellaAdd .gitignore file.
2007-09-21 Leandro LucarellaAvoid a weird gcc warning when compiling with optimizat...
2007-09-21 Leandro LucarellaFix an implicit cast from const char* (string literal...
2007-08-27 Leandro LucarellaChange status to reflect current library stability.0.7
2007-08-27 Leandro LucarellaFix documentation about broken libevent version.
2007-08-27 Leandro LucarellaRemove last trails of darcs repository.
2007-08-27 Leandro LucarellaChange version number.
2007-08-27 Leandro LucarellaUse git instead of darcs.
2007-08-26 Leandro LucarellaUpdate Doxyfile to doxygen version 1.5.3.
2007-08-26 Leandro LucarellaSplit documentation.
...
tags
16 years ago 1.0
16 years ago 0.7
16 years ago 0.6 0.6
16 years ago 0.5 0.5
16 years ago 0.4 0.4
16 years ago 0.3 0.3
16 years ago 0.2 0.2
16 years ago 0.1 0.1
16 years ago darcs_import
heads
16 years ago master
16 years ago mob
forks
Cached version (3328s old)
eventxx/ioevent.git I/O events, in style of ev++.h, for libev... chris.brody@gmail.com 16 years ago