Update thread_create to only yield CPU to the new thread if necessary
This commit is contained in:
@@ -261,6 +261,10 @@ thread_create (const char *name, int priority,
|
||||
|
||||
/* Add to run queue. */
|
||||
thread_unblock (t);
|
||||
|
||||
/* Yield if the newly created thread has higher priority than the current
|
||||
thread. */
|
||||
if (t->priority > thread_current ()->priority)
|
||||
thread_yield ();
|
||||
|
||||
return tid;
|
||||
|
||||
Reference in New Issue
Block a user