3 * c++ -I/usr/local/include -o time-test time-test.cpp -L/usr/local/lib -levent
5 * Wed 2006-12-27 - Modified by Leandro Lucarella <llucax+eventxx@gmail.com>
7 * Adapted to test the C++ inteface.
11 #include <sys/types.h>
14 #include <sys/socket.h>
25 typedef void (cb_t)(int, short);
30 eventxx::dispatcher d;
31 eventxx::event< cb_t >* ev;
34 write_cb(int fd, short event)
36 char *test = "test string";
39 len = write(fd, test, strlen(test) + 1);
41 printf("%s: write %d%s\n", __func__,
42 len, len ? "" : " - means EOF");
48 } else if (called == 1)
55 main (int argc, char **argv)
57 if (signal(SIGPIPE, SIG_IGN) == SIG_IGN)
60 if (socketpair(AF_UNIX, SOCK_STREAM, 0, pair) == -1)
63 /* Initalize one event */
64 ev = new eventxx::event< cb_t >(pair[1], EV_WRITE, write_cb);