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