Update releasing of locks to update donation information w/ S
This commit is contained in:
@@ -265,6 +265,18 @@ lock_release (struct lock *lock)
|
||||
ASSERT (lock != NULL);
|
||||
ASSERT (lock_held_by_current_thread (lock));
|
||||
|
||||
struct thread *current_thread = thread_current ();
|
||||
struct list_elem *tail = list_tail (¤t_thread->donors_list);
|
||||
for (struct list_elem *e = list_begin (¤t_thread->donors_list);
|
||||
e != tail; e = e->next)
|
||||
{
|
||||
struct thread *donor = list_entry (e, struct thread, donor_elem);
|
||||
if (donor->waiting_lock == lock)
|
||||
list_remove (e);
|
||||
}
|
||||
|
||||
thread_recalculate_priority ();
|
||||
|
||||
lock->holder = NULL;
|
||||
sema_up (&lock->semaphore);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user