diff --git a/src/threads/thread.c b/src/threads/thread.c index dd472c1..e93eeb8 100644 --- a/src/threads/thread.c +++ b/src/threads/thread.c @@ -634,17 +634,16 @@ init_thread (struct thread *t, const char *name, int nice, int priority, t->status = THREAD_BLOCKED; strlcpy (t->name, name, sizeof t->name); t->stack = (uint8_t *) t + PGSIZE; + t->magic = THREAD_MAGIC; + + t->base_priority = priority; + list_init (&t->donors_list); + t->waiting_lock = NULL; t->nice = nice; t->recent_cpu = recent_cpu; - - t->base_priority = priority; - - t->magic = THREAD_MAGIC; - - list_init (&t->donors_list); - t->priority = thread_mlfqs ? calculate_bsd_priority (recent_cpu, nice) : t->base_priority; - t->waiting_lock = NULL; + t->priority = thread_mlfqs ? calculate_bsd_priority (recent_cpu, nice) + : t->base_priority; old_level = intr_disable (); list_push_back (&all_list, &t->allelem);