-CXXFLAGS=-I.. -g
+CXXFLAGS=-I.. -g -Wall
# Uncomment this if you have a fixed event_base_free().
# See http://www.mail-archive.com/libevent-users@monkey.org/msg00112.html
-#CXXFLAGS+=-DEVENT_BASE_FREE_FIX
+CXXFLAGS+=-DEVENT_BASE_FREE_FIX
LDFLAGS=-levent
-targets=bench test-eof test-time test-weof
+targets=bench test-eof test-time test-weof trivial c-way
all: $(targets)
--- /dev/null
+#include <eventxx>
+#include <iostream>
+#include <csignal>
+
+eventxx::dispatcher d;
+
+void sighandler(int signum, short event, void* data)
+{
+ unsigned &i = *(unsigned*)data;
+ std::cout << ++i << " interrupts, ";
+ if (i < 5) std::cout << "keep going...\n";
+ else
+ {
+ std::cout << "done!\n";
+ d.exit();
+ }
+}
+
+int main()
+{
+ int var = 0;
+ eventxx::csignal sigev(SIGINT, sighandler, &var);
+ d.add(sigev);
+ d.dispatch();
+ return 0;
+}
+
--- /dev/null
+#include <eventxx>
+#include <iostream>
+#include <csignal>
+
+using eventxx::dispatcher;
+
+struct handler
+{
+ dispatcher& d;
+ int i;
+ handler(dispatcher& d): d(d), i(0) {}
+ void operator() (int signum, short event)
+ {
+ std::cout << ++i << " interrupts, ";
+ if (i < 5) std::cout << "keep going...\n";
+ else
+ {
+ std::cout << "done!\n";
+ d.exit();
+ }
+ }
+};
+
+int main()
+{
+ dispatcher d;
+ handler h(d);
+ eventxx::signal< handler > e(SIGINT, h);
+ d.add(e);
+ d.dispatch();
+ return 0;
+}
+
--- /dev/null
+#include <eventxx>
+
+int main()
+{
+ eventxx::dispatcher d;
+ d.dispatch();
+ return 0;
+}
+