Wait for the tasks using join_all
This commit is contained in:
parent
fdb0b43ce8
commit
b7ff776e06
1 changed files with 5 additions and 2 deletions
|
@ -1,4 +1,4 @@
|
|||
use std::time::Duration;
|
||||
use std::{pin::Pin, time::Duration};
|
||||
|
||||
fn main() {
|
||||
trpl::run(async {
|
||||
|
@ -39,6 +39,9 @@ fn main() {
|
|||
}
|
||||
};
|
||||
|
||||
trpl::join!(tx1_fut, tx_fut, rx_fut);
|
||||
let futures: Vec<Pin<Box<dyn Future<Output = ()>>>> =
|
||||
vec![Box::pin(tx1_fut), Box::pin(rx_fut), Box::pin(tx_fut)];
|
||||
|
||||
trpl::join_all(futures).await;
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue