mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-23 12:13:22 +00:00
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:
17
user/apps/test_tokio/src/main.rs
Normal file
17
user/apps/test_tokio/src/main.rs
Normal 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;
|
||||
}
|
Reference in New Issue
Block a user