Prevent double panic in the Drop of TaksPoolInner (#1064)
This commit is contained in:
parent
814c413372
commit
906b406f6a
@ -69,10 +69,12 @@ impl Drop for TaskPoolInner {
|
|||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
self.shutdown_tx.close();
|
self.shutdown_tx.close();
|
||||||
|
|
||||||
|
let panicking = thread::panicking();
|
||||||
for join_handle in self.threads.drain(..) {
|
for join_handle in self.threads.drain(..) {
|
||||||
join_handle
|
let res = join_handle.join();
|
||||||
.join()
|
if !panicking {
|
||||||
.expect("Task thread panicked while executing.");
|
res.expect("Task thread panicked while executing.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user