8000 GitHub - colinmarc/mio-timerfd: Wrapping linux's timerfd for mio
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

colinmarc/mio-timerfd

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Wrapping linux's timerfd for mio

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 100.0%
0