summaryrefslogtreecommitdiff
path: root/kernel/proc.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/proc.c')
-rw-r--r--kernel/proc.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/kernel/proc.c b/kernel/proc.c
index bc4b274..809d112 100644
--- a/kernel/proc.c
+++ b/kernel/proc.c
@@ -447,12 +447,12 @@ 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(;;){
+ // 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++) {
acquire(&p->lock);
if(p->state == RUNNABLE) {