diff --git a/src/threads/thread.c b/src/threads/thread.c index 2d931e2..96d72be 100644 --- a/src/threads/thread.c +++ b/src/threads/thread.c @@ -223,6 +223,10 @@ thread_create (const char *name, int priority, /* Add to run queue. */ 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; }