Merge task1/themis/priority-donation into task1/priority-donation #13

Merged
td1223 merged 4 commits from task1/themis/priority-donation into task1/priority-donation 2024-10-23 15:03:08 +00:00
3 changed files with 33 additions and 13 deletions
Showing only changes of commit 5f8dea21be - Show all commits

View File

@@ -210,24 +210,26 @@ donate_priority (struct thread *donee) {
if (donor->priority <= donee->priority) if (donor->priority <= donee->priority)
break; break;
donee->priority = donor->priority;
/* Also stop propagation of donation once a donee is reached with /* Also stop propagation of donation once a donee is reached with
no donees of its own (sink node in WFG). */ no donees of its own (sink node in WFG). */
if (donee->waiting_lock == NULL) if (donee->waiting_lock == NULL)
{ {
/* Only the sink node of the WFG isn't waiting for a lock and /* Only the sink node of the WFG isn't waiting for a lock and
could be on the ready list. Thus, as its priority changed, could be on the ready list. Thus, as its priority changed,
it must be reinserted into the list. */ it must be reinserted into the list. */
enum intr_level old_level = intr_disable (); enum intr_level old_level = intr_disable ();
donee->priority = donor->priority;
ready_list_reinsert (donee); ready_list_reinsert (donee);
intr_set_level (old_level); intr_set_level (old_level);
donee = NULL; donee = NULL;
} }
else else
{
donee->priority = donor->priority;
donee = donee->waiting_lock->holder; donee = donee->waiting_lock->holder;
} }
}
} }
/* Acquires LOCK, sleeping until it becomes available if /* Acquires LOCK, sleeping until it becomes available if