epoll
Safe wrapper around the Linux kernel's epoll API.
Documentation
Example Usage
extern crate epoll;
use std::sync::{Arc, Mutex};
use epoll::*;
type InterestList = Arc<Mutex<Vec<Interest>>>;
fn event_loop(mut epoll: EpollInstance,
register: InterestList,
modify: InterestList,
remove: InterestList)
{
loop {
{
let mut list = register.lock().unwrap();
for interest in list.drain(..) {
epoll.add_interest(interest).unwrap();
}
}
{
let list = modify.lock().unwrap();
for ref interest in list.iter() {
epoll.mod_interest(interest).unwrap();
}
}
{
let list = remove.lock().unwrap();
for ref interest in list.iter() {
epoll.del_interest(interest).unwrap();
}
}
let indefinite: i32 = -1;
let max_returned: usize = 100;
let event_buf = epoll.wait(indefinite, max_returned).unwrap();
handle_events(event_buf);
}
}
fn handle_events(events: Vec<Interest>) {
}
Author
Nathan Sizemore, nathanrsizemore@gmail.com
License
hydrogen is available under the MPL-2.0 license. See the LICENSE file for more info.