Don't panic in WorkController::drop
parent
6b2a1f7757
commit
7b631beb0a
|
@ -220,7 +220,7 @@ impl Drop for State {
|
|||
use nix::sys::wait::{waitpid, WaitPidFlag};
|
||||
/* Try wait, we don't want to block */
|
||||
if let Err(e) = waitpid(child_pid, Some(WaitPidFlag::WNOHANG)) {
|
||||
eprintln!("Failed to wait on subprocess {}: {}", child_pid, e);
|
||||
debug!("Failed to wait on subprocess {}: {}", child_pid, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,8 +64,10 @@ pub struct WorkController {
|
|||
|
||||
impl Drop for WorkController {
|
||||
fn drop(&mut self) {
|
||||
for _ in 0..self.threads.lock().unwrap().len() {
|
||||
self.thread_end_tx.send(true).unwrap();
|
||||
if let Ok(lock) = self.threads.lock() {
|
||||
for _ in 0..lock.len() {
|
||||
let _ = self.thread_end_tx.send(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue