adaptive epoll/kqueue timeout