xref: /DragonOS/user/apps/test_tokio/src/main.rs (revision f9fe30be89e89499aad4ef52b4648986bef5a7d8)
1 use tokio::signal;
2 
3 async fn say_world() {
4     println!("world");
5 }
6 
7 #[tokio::main(flavor = "current_thread")]
8 async fn main() {
9     // Calling `say_world()` does not execute the body of `say_world()`.
10     let op = say_world();
11 
12     // This println! comes first
13     println!("hello");
14 
15     // Calling `.await` on `op` starts executing `say_world`.
16     op.await;
17 }
18