feat: 增加tokio异步运行时支持 (#894)

* fix the EventFdFlags error

* feat: support tokio (Single thread version)

Fix deadlock issue on closing file.
Add function for PipeInode and EventFdInode.
This commit is contained in:
linfeng
2024-08-19 18:50:17 +08:00
committed by GitHub
parent 09836e1b39
commit 4afc5b7b7b
9 changed files with 192 additions and 14 deletions

View File

@ -0,0 +1,17 @@
use tokio::signal;
async fn say_world() {
println!("world");
}
#[tokio::main(flavor = "current_thread")]
async fn main() {
// Calling `say_world()` does not execute the body of `say_world()`.
let op = say_world();
// This println! comes first
println!("hello");
// Calling `.await` on `op` starts executing `say_world`.
op.await;
}