in reverie-ptrace/src/trace/notifier.rs [224:242]
fn worker_thread(pid: Pid, event: Arc<Event>) {
while let Some(status) = wait(pid) {
if let Some(old_status) = event.update(status) {
if status != PTRACE_EVENT_EXIT_STOP && !libc::WIFEXITED(status) {
panic!(
"Got unexpected event: Event {:?} replaced {:?}",
WaitStatus::from_raw(pid.into(), status),
WaitStatus::from_raw(pid.into(), old_status),
);
}
}
// Try to avoid reaching an ECHILD error by terminating the loop on the
// last event.
if libc::WIFEXITED(status) || libc::WIFSIGNALED(status) {
break;
}
}
}