4 releases

0.2.0 May 2, 2020
0.1.2 Oct 5, 2019
0.1.1 Sep 23, 2019
0.1.0 Sep 17, 2019

#296 in Asynchronous

Download history 32/week @ 2020-11-09 35/week @ 2020-11-16 39/week @ 2020-11-23 51/week @ 2020-11-30 43/week @ 2020-12-07 36/week @ 2020-12-14 30/week @ 2020-12-21 33/week @ 2020-12-28 47/week @ 2021-01-04 36/week @ 2021-01-11 55/week @ 2021-01-18 38/week @ 2021-01-25 71/week @ 2021-02-01 131/week @ 2021-02-08 330/week @ 2021-02-15 245/week @ 2021-02-22

192 downloads per month

MIT license

21KB
366 lines

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);

Dependencies

~375–600KB
~12K SLoC