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