diff --git a/devices/timer.c b/devices/timer.c index 8205bf7ccc083c0f9d8800d2b505f7bd7639566a..2177686822e2464e1ad9185cb7e1d0815bf30af8 100644 --- a/devices/timer.c +++ b/devices/timer.c @@ -96,7 +96,7 @@ void timer_sleep(int64_t ticks) current_thread->wakeup_time = start + ticks; // Add the calling thread to the sleep queue - list_insert_ordered(&ready_to_run, ¤t_thread->elem, thread_wakeup_compare, NULL); + list_insert_ordered(&ready_to_run, ¤t_thread->sleep_element, thread_wakeup_compare, NULL); // Block the calling thread thread_block(); @@ -174,7 +174,7 @@ static void timer_interrupt(struct intr_frame* args UNUSED) ticks++; while (!list_empty(&ready_to_run)) { - struct thread * current_thread = list_entry(list_front(&ready_to_run), struct thread, elem); + struct thread * current_thread = list_entry(list_front(&ready_to_run), struct thread, sleep_element); if(current_thread->wakeup_time <= ticks) { list_pop_front(&ready_to_run); @@ -253,8 +253,8 @@ static void real_time_delay(int64_t num, int32_t denom) bool thread_wakeup_compare(const struct list_elem* a, const struct list_elem* b, void* aux) { - struct thread *thread_a = list_entry(a, struct thread, elem); - struct thread *thread_b = list_entry(b, struct thread, elem); + struct thread *thread_a = list_entry(a, struct thread, sleep_element); + struct thread *thread_b = list_entry(b, struct thread, sleep_element); return thread_a->wakeup_time < thread_b->wakeup_time; } \ No newline at end of file