priority donation refactoring #20

Merged
sb3923 merged 3 commits from task1/saleh/priority-donation-refactoring into master 2024-10-25 15:57:23 +00:00
Showing only changes of commit 81309dcda9 - Show all commits

View File

@@ -114,13 +114,13 @@ sema_up (struct semaphore *sema)
old_level = intr_disable (); old_level = intr_disable ();
if (!list_empty (&sema->waiters)) if (!list_empty (&sema->waiters))
{ {
/* Enforces wake-up of the highest priority thread waiting for the /* Enforces wake-up of the highest priority thread waiting for the
semaphore. */ semaphore. */
struct list_elem *e = list_min (&sema->waiters, priority_more, NULL); struct list_elem *e = list_min (&sema->waiters, priority_more, NULL);
list_remove (e); list_remove (e);
thread_unblock (list_entry (e, struct thread, elem)); thread_unblock (list_entry (e, struct thread, elem));
} }
sema->value++; sema->value++;
intr_set_level (old_level); intr_set_level (old_level);