3 * c++ -I/usr/local/include -o time-test time-test.c -L/usr/local/lib -levent
6 * Wed 2006-12-27 - Modified by Leandro Lucarella <llucax+eventxx@gmail.com>
8 * Adapted to test the C++ inteface.
12 #include <sys/types.h>
15 #include <sys/socket.h>
27 eventxx::dispatcher d;
31 read_cb(int fd, short event, void *arg)
36 len = read(fd, buf, sizeof(buf));
38 printf("%s: read %d%s\n", __func__,
39 len, len ? "" : " - means EOF");
44 } else if (called == 1)
51 main (int argc, char **argv)
53 char *test = "test string";
56 if (socketpair(AF_UNIX, SOCK_STREAM, 0, pair) == -1)
59 write(pair[0], test, strlen(test)+1);
60 shutdown(pair[0], SHUT_WR);
62 /* Initalize one event */
63 ev = new eventxx::cevent(pair[1], eventxx::READ, read_cb, NULL);