1
0
mirror of https://github.com/rcore-os/rCore.git synced 2024-11-22 08:06:17 +04:00

Fix sys_wait4 finally

This commit is contained in:
Jiajie Chen 2020-06-16 20:19:09 +08:00
parent c6818ccbb6
commit 96793936e9

View File

@ -136,10 +136,16 @@ impl Syscall<'_> {
// if found, return
if let Some((pid, exit_code)) = find {
info!("wait: found pid {}", pid);
// remove from process table
if true {
let mut process_table = PROCESSES.write();
process_table.remove(&pid.get());
}
// remove from children
proc.children.retain(|(p, _)| *p != pid);
if let Some(mut wstatus) = wstatus {
wstatus.write(exit_code as i32)?;
}
@ -173,7 +179,8 @@ impl Syscall<'_> {
let eventbus = proc.eventbus.clone();
drop(proc);
wait_for_event(eventbus, Event::CHILD_PROCESS_QUIT).await;
wait_for_event(eventbus.clone(), Event::CHILD_PROCESS_QUIT).await;
eventbus.lock().clear(Event::CHILD_PROCESS_QUIT);
}
}