usertests and optional finished
This commit is contained in:
@ -401,8 +401,20 @@ exit(int status)
|
||||
release(&wait_lock);
|
||||
|
||||
// Jump into the scheduler, never to return.
|
||||
// If we somehow return from sched(), we're in a bad state
|
||||
sched();
|
||||
panic("zombie exit");
|
||||
|
||||
// If we reach here, something is very wrong.
|
||||
// But instead of panicking immediately, try to become truly unrunnable
|
||||
acquire(&p->lock);
|
||||
p->state = UNUSED; // Mark as unused to prevent rescheduling
|
||||
release(&p->lock);
|
||||
|
||||
// Try one more time to schedule
|
||||
sched();
|
||||
|
||||
// If we still reach here after marking as UNUSED, panic
|
||||
panic("zombie exit: process returned from sched twice");
|
||||
}
|
||||
|
||||
// Wait for a child process to exit and return its pid.
|
||||
|
||||
Reference in New Issue
Block a user