-
Carl Lerche authored
Based on #280 by luca-barbieri Currently run() results in the process waking up every second or every timer tick if set lower because a timeout is passed to the OS wait function. This changes the code so that run_once() still uses the timeout, but run() will instruct the OS to wait forever when there are no timers. The notify mechanism already uses a pipe for awakening the event loop, so there should be no need to use a timeout for that. This saves CPU time and battery, and is generally the correct behavior. Miscellaneous notes: * We also fix epoll because the maximum timeout supported by the Linux kernel is i32::MAX, not isize::MAX. * We fix next_tick_ms() being truncated from u64 to usize * It requires carllerche/nix-rust#192 to allow specifying no timeout to kevent() * The public API of Poll::poll is changed, but that can be avoided if desired. Closes #289
7b73ce83