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
2 changed files with 12 additions and 8 deletions
Showing only changes of commit 30ab3ae861 - Show all commits

View File

@@ -261,6 +261,10 @@ thread_create (const char *name, int priority,
/* Add to run queue. */ /* Add to run queue. */
thread_unblock (t); thread_unblock (t);
/* Yield if the newly created thread has higher priority than the current
thread. */
if (t->priority > thread_current ()->priority)
thread_yield (); thread_yield ();
return tid; return tid;