Skip to content

wait until all the threads had stoped running #4243

Answered by Darksonn
ghost asked this question in Q&A
Discussion options

You must be logged in to vote
let mut handles = Vec::new();

for system in &system_box.system {
    let canvas = canvas.clone();
    let handle = tokio::spawn((system)(canvas));
    handles.push(handle);
}

for handle in handles {
    handle.await.unwrap();
}

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@ghost
Comment options

@Darksonn
Comment options

Answer selected
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant