Use epoll instead of poll, factor all threads into one