xref: /DragonOS/user/apps/test_tokio/src/main.rs (revision 232570ae98cbd1d618cd1208deaef4c220ab41dd)
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