Implement priority donation helper function with propagation, w/ T
This commit is contained in:
@@ -188,7 +188,21 @@ lock_init (struct lock *lock)
|
||||
}
|
||||
|
||||
static void
|
||||
donate_priority (struct thread *donor, struct thread *donee);
|
||||
donate_priority (struct thread *donor, struct thread *donee) {
|
||||
while (donee != NULL)
|
||||
{
|
||||
if (donor->priority <= donee->priority)
|
||||
break;
|
||||
|
||||
donee->priority = donor->priority;
|
||||
if (donee->waiting_lock == NULL)
|
||||
donee = NULL;
|
||||
else
|
||||
donee = donee->waiting_lock->holder;
|
||||
}
|
||||
|
||||
ready_list_reorder ();
|
||||
}
|
||||
|
||||
/* Acquires LOCK, sleeping until it becomes available if
|
||||
necessary. The lock must not already be held by the current
|
||||
|
||||
Reference in New Issue
Block a user