we must retain the lock while executing the timeout
minor tweaks to prevent calling epoll with a -1 timeout

which would cause it to wait indefinitely
(and since there might be no filedescriptors, it could just block
until interrupted by a signal)