xref: /DragonOS/user/apps/test_tokio/src/main.rs (revision fae6e9ade46a52976ad5d099643d51cc20876448)

say_world()1 async fn say_world() {
2     println!("world");
3 }
4 
5 #[tokio::main(flavor = "current_thread")]
main()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