Relative Content

Tag Archive for joinrusttry-catchspawn

tokio::try_join! doesn’t return early for tokio::spawn handlers

#[tokio::main] async fn main() -> io::Result<()> { // … let handle1 = tokio::spawn( async move {method1().await }); let handle2 = tokio::spawn( async move {method2().await }); let handle3 = tokio::spawn( async move {method3().await }); let (handle1_ret, handle2_ret, handle3_ret) = tokio::join!(handle1, handle2, handle3)?; match handle1_ret { Ok(_) => info!(“handle1 closed”); Err(e) => error!(“handle1 failed”); } match handle2_ret […]