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