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