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