Wrapper of linux timerfds for mio
add travis ci
correct now-incorrect comment about time ranges
d876f53b — Dries Bossers a month ago
libc's timespec can be different depending on the target architecture

refs

master
browse log

clone

read-only
https://git.sr.ht/~oefd/mio-timerfd
read/write
git@git.sr.ht:~oefd/mio-timerfd

You can also use your local clone with git send-email.

mio-timerfd

crates.io license build status

A mio wrapper for linux's timerfd feature. For linux-specific software this is likely the easiest (and probably most performant, but I'm not benchmarking) way to get asynchronous timers into your code.

simple example

let poll = Poll::new().unwrap();
let mut events = Events::with_capacity(1024);
let mut timer = TimerFd::new(ClockId::Monotonic).unwrap();
timer.set_timeout_interval(&Duration::from_millis(10)).unwrap();
poll.register(&timer, Token(0), Ready::readable(), PollOpt::edge())
    .unwrap();

// effectively sleeps the thread for 10ms
poll.poll(&mut events, None).unwrap();
assert!(timer.read().unwrap() == 1);