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) {
|
||||
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.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user