Fix syn-read, syn-write, and always free elements from donors_list
This commit is contained in:
@@ -373,7 +373,9 @@ thread_exit (void)
|
||||
and schedule another process. That process will destroy us
|
||||
when it calls thread_schedule_tail(). */
|
||||
intr_disable ();
|
||||
list_remove (&thread_current()->allelem);
|
||||
struct thread *t = thread_current ();
|
||||
list_remove (&t->allelem);
|
||||
list_remove (&t->donor_elem);
|
||||
thread_current ()->status = THREAD_DYING;
|
||||
schedule ();
|
||||
NOT_REACHED ();
|
||||
@@ -679,6 +681,7 @@ init_thread (struct thread *t, const char *name, int nice, int priority,
|
||||
t->base_priority
|
||||
= thread_mlfqs ? calculate_bsd_priority (recent_cpu, nice) : priority;
|
||||
list_init (&t->donors_list);
|
||||
list_push_back (&t->donors_list, &t->donor_elem);
|
||||
t->waiting_lock = NULL;
|
||||
|
||||
t->nice = nice;
|
||||
|
||||
Reference in New Issue
Block a user