Make clear_exited_pid work on running processes
This commit is contained in:
parent
4548d9540e
commit
50e7b7236e
@ -354,10 +354,13 @@ impl Tasking {
|
||||
|
||||
|
||||
pub fn clear_exited_pid(&self, pid: usize) -> Result<(), ()> {
|
||||
if self.current_pid() == Some(pid) {
|
||||
return Err(());
|
||||
}
|
||||
let mut processes = self.processes.write();
|
||||
let process = processes.get(pid).ok_or(())?;
|
||||
if *process.sleeping.read() != Some(SleepReason::Exited) {
|
||||
return Err(());
|
||||
if process.sleeping.read().is_none() {
|
||||
self.ready_to_run.lock().retain(|e| *e != pid);
|
||||
}
|
||||
self.freeable_kstacks.lock().push(processes.remove(pid).kernel_stack);
|
||||
Ok(())
|
||||
|
Loading…
Reference in New Issue
Block a user