Skip to content

Commit

Permalink
Prevent double panic in the Drop of TaksPoolInner
Browse files Browse the repository at this point in the history
  • Loading branch information
refnil committed Dec 14, 2020
1 parent e511cdb commit 8ed9244
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions crates/bevy_tasks/src/task_pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,12 @@ impl Drop for TaskPoolInner {
fn drop(&mut self) {
self.shutdown_tx.close();

let panicking = thread::panicking();
for join_handle in self.threads.drain(..) {
join_handle
.join()
.expect("Task thread panicked while executing.");
let res = join_handle.join();
if !panicking {
res.expect("Task thread panicked while executing.");
}
}
}
}
Expand Down

0 comments on commit 8ed9244

Please sign in to comment.