oops. scheduler() inherits the interrupt status of the
most recent process to run, so it must explicitly turn them on again. It would be better if cpu->intena were really thread->intena.
This commit is contained in:
parent
f376ad7f1f
commit
4a88273db5
1 changed files with 4 additions and 4 deletions
|
@ -447,12 +447,12 @@ scheduler(void)
|
||||||
struct proc *p;
|
struct proc *p;
|
||||||
struct cpu *c = mycpu();
|
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;
|
c->proc = 0;
|
||||||
for(;;){
|
for(;;){
|
||||||
|
// The most recent process to run may have had interrupts
|
||||||
|
// turned off; turn them on to avoid deadlock.
|
||||||
|
intr_on();
|
||||||
|
|
||||||
for(p = proc; p < &proc[NPROC]; p++) {
|
for(p = proc; p < &proc[NPROC]; p++) {
|
||||||
acquire(&p->lock);
|
acquire(&p->lock);
|
||||||
if(p->state == RUNNABLE) {
|
if(p->state == RUNNABLE) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue