Wait for the tasks using join_all

This commit is contained in:
Manuel Thalmann 2025-04-06 23:04:29 +02:00
parent fdb0b43ce8
commit b7ff776e06
Signed by: manuth
SSH key fingerprint: SHA256:HsMLC+7kJWALP6YCYCoopxNbUnghwSGLVcG76SECT5c

View file

@ -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;
});
}