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