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