thestinger/playpen — pull request #38 by vodik (2014-08-05 01:49:39+00:00)
Title: redo the event loop for better behaviour

epoll may return multiple events at the same time, we need to process
each of them (EPOLLHUP and EPOLLIN can arrive at the same time).

Handle EPOLLHUP on stdin to detect when redirected input to playpen has
finished. This should trigger pipe_in[1] to be closed.

We also have to manually remove stdin from the epoll loop because epoll
can only automatically do that for us when the file descriptor is
destroyed. Since stdin is shared, its not actually destroyed and thus
this doesn't happen (see Q6 in epoll(7)).