diff --git a/src/devices/timer.c b/src/devices/timer.c index 4bb602e..e7fdc53 100644 --- a/src/devices/timer.c +++ b/src/devices/timer.c @@ -119,9 +119,6 @@ timer_sleep (int64_t ticks) NULL); intr_set_level (old_level); sema_down (&st.semaphore); - old_level = intr_disable (); - list_remove (&st.elem); - intr_set_level (old_level); } /* Sleeps for approximately MS milliseconds. Interrupts must be @@ -204,7 +201,10 @@ timer_interrupt (struct intr_frame *args UNUSED) { struct asleep_thread *st = list_entry (e, struct asleep_thread, elem); if (ticks >= st->end_at) - sema_up (&st->semaphore); + { + list_remove (&st->elem); + sema_up (&st->semaphore); + } else break; }