scheduler()'s intr_on() is in the wrong place, reflecting

the locking scheme from long ago.
This commit is contained in:
Robert Morris 2022-10-16 15:28:21 -04:00
parent 348cf7fee4
commit f376ad7f1f

View file

@ -446,12 +446,13 @@ scheduler(void)
{
struct proc *p;
struct cpu *c = mycpu();
// Interrupts are disabled at first, but they must be
// enabled in order for the shell to get input.
intr_on();
c->proc = 0;
for(;;){
// Avoid deadlock by ensuring that devices can interrupt.
intr_on();
for(p = proc; p < &proc[NPROC]; p++) {
acquire(&p->lock);
if(p->state == RUNNABLE) {