A rust interface to the Linux kernel's timerfd API.
Example
use ;
use Duration;
// Create a new timerfd
// (unwrap is actually fine here for most usecases)
let mut tfd = new.unwrap;
// The timer is initially disarmed
assert_eq!;
// Set the timer
tfd.set_state;
// Observe that the timer is now set
match tfd.get_state
// Wait for the remaining time
tfd.read;
// It was a oneshot timer, so it's now disarmed
assert_eq!;
Usage
Unfortunately, this example can't show why you would use
timerfd in the first place: Because it creates a file descriptor
that you can monitor with select(2), poll(2) and epoll(2).
In other words, the only advantage this offers over any other
timer implementation is that it implements the AsRawFd trait.
The file descriptor becomes ready/readable whenever the timer expires.