Prevent double panic in the Drop of TaksPoolInner (#1064)

This commit is contained in:
Martin Lavoie 2020-12-22 20:21:21 +00:00 committed by GitHub
parent 814c413372
commit 906b406f6a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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