6 using eventxx::dispatcher;
8 #define OSASSERT(func, ...) if (func(__VA_ARGS__) == -1) { perror(#func "()"); exit(1); }
14 std::map< int, eventxx::basic_event* > events;
15 handler(dispatcher& d): d(d)
18 OSASSERT(pipe, fds+2);
20 void add(eventxx::basic_event& e)
24 void operator() (int fd, eventxx::type event)
27 OSASSERT(read, fd, buf, 7);
28 std::cout << "Read from fd " << fd << ": " << buf << "\n";
37 OSASSERT(write, h.fds[1], "hola 1", 7);
38 OSASSERT(write, h.fds[3], "hola 2", 7);
39 eventxx::event< handler > e1(h.fds[0], eventxx::READ, h);
40 eventxx::event< handler > e2(h.fds[2], eventxx::READ, h);