Libraries Libevent - event notifications on file descriptors The event API provides a mechanism to execute a function when a specific event on a file descriptor occurs or after at a given time has passed. Service setup example: socketpair(AF_UNIX, SOCK_STREAM, 0, pair); close(pair[1]); con->pfd = pair[0]; event_set(&con->pread, con->pfd, EV_READ, cmd_read, con); event_set(&con->pwrite, con->pfd, EV_WRITE, cmd_write, con); event_add(&con->pread, NULL); void cmd_read(int fd, short which, void *arg) { struct tcp_con *con = arg; [...] tcp_senddata(con, TH_ACK); again: cmd_trigger_read(con); }