7 using eventxx::dispatcher;
9 #define OSASSERT(func, ...) \
10 if (func(__VA_ARGS__) == -1) { perror(#func "()"); std::exit(1); }
16 std::map< int, eventxx::basic_event* > events;
17 handler(dispatcher& d): d(d)
20 OSASSERT(pipe, fds+2);
22 void add(eventxx::basic_event& e)
26 void operator() (int fd, eventxx::type event)
29 OSASSERT(read, fd, buf, 7);
30 std::cout << "Read from fd " << fd << ": " << buf << "\n";
39 OSASSERT(write, h.fds[1], "hola 1", 7);
40 OSASSERT(write, h.fds[3], "hola 2", 7);
41 eventxx::event< handler > e1(h.fds[0], eventxx::READ, h);
42 eventxx::event< handler > e2(h.fds[2], eventxx::READ, h);