diff --git a/src/threads/thread.c b/src/threads/thread.c index 5ae0a09..880737a 100644 --- a/src/threads/thread.c +++ b/src/threads/thread.c @@ -72,7 +72,7 @@ static void init_thread (struct thread *, const char *name, int nice, static bool is_thread (struct thread *) UNUSED; static void *alloc_frame (struct thread *, size_t size); static int calculate_bsd_priority (fp32_t recent_cpu, int nice); -static void thread_update_recent_cpu (struct thread *t, void *aux UNUSED); +static void update_recent_cpu (struct thread *t, void *aux UNUSED); static void schedule (void); void thread_schedule_tail (struct thread *prev); static tid_t allocate_tid (void); @@ -171,7 +171,7 @@ thread_tick (void) fp32_t new_coeff = fp_div_int (fp_from_int (ready), 60); load_avg = fp_add (old_coeff, new_coeff); - thread_foreach (thread_update_recent_cpu, NULL); + thread_foreach (update_recent_cpu, NULL); } if (ticks % TIME_SLICE == 0) // recent_cpu was updated, update priority. @@ -225,8 +225,8 @@ thread_create (const char *name, int priority, return TID_ERROR; /* Initialize thread. */ - struct thread *pt = thread_current (); - init_thread (t, name, pt->nice, priority, pt->recent_cpu); + struct thread *parent_thread = thread_current (); + init_thread (t, name, parent_thread->nice, priority, parent_thread->recent_cpu); tid = t->tid = allocate_tid (); /* Prepare thread for first run by initializing its stack. @@ -454,7 +454,7 @@ thread_get_priority (void) /* Updates recent_cpu for a thread. */ static void -thread_update_recent_cpu (struct thread *t, void *aux UNUSED) +update_recent_cpu (struct thread *t, void *aux UNUSED) { fp32_t curr_recent_cpu = t->recent_cpu; fp32_t dbl_load_avg = fp_mul_int (load_avg, 2);