Update creating thread to yield if the new thread has higher priority
This commit is contained in:
@@ -223,6 +223,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 new thread has a higher priority than the current thread. */
|
||||||
|
if (priority > thread_get_priority ())
|
||||||
|
thread_yield ();
|
||||||
|
|
||||||
return tid;
|
return tid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user