xenevtchn: implement async processing model

This commit is contained in:
Alex Zenla
2024-02-14 20:50:11 +00:00
parent 822b2e0227
commit 4955ed3a1c
4 changed files with 132 additions and 23 deletions

View File

@ -1,11 +1,12 @@
use xenevtchn::error::Result;
use xenevtchn::EventChannel;
fn main() -> Result<()> {
let mut channel = EventChannel::open()?;
println!("Channel opened.");
let port = channel.bind_unbound_port(1)?;
#[tokio::main]
async fn main() -> Result<()> {
let channel = EventChannel::open().await?;
println!("channel opened");
let port = channel.bind_unbound_port(0).await?;
println!("port: {}", port);
channel.unbind(port)?;
channel.unbind(port).await?;
Ok(())
}