When the custom poll function told us there is activity on the
epoll fd, don't do a blocking wait on the epoll fd. It might be
possible that the active fd is removed and then we would block
forever.
Fixes#349
The mainloop time_new is supposed to be called with wallclock time
but some apps use rttime instead. Handle the case better so that we
never end up disabling the timer.
Detect if the mainloop_api is one of ours and use the loop directly in
that case. Otherwise, make a new loop and add the fd to the foreign
mainloop_api. Make sure we clean up as well.
Fixes#345