X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Ftests%2Fthreads%2Fpriority-change.c;h=810b05a1d76973ebdf28f914d03c91318c021e85;hb=2c01b318e4bc07464a59fe5d21bc520978d82540;hp=456de33a27217c4e5647bb2b1329635ee836ad8c;hpb=4ebf33908a571a7cde93fe618902b044e3633cdf;p=pintos-anon diff --git a/src/tests/threads/priority-change.c b/src/tests/threads/priority-change.c index 456de33..810b05a 100644 --- a/src/tests/threads/priority-change.c +++ b/src/tests/threads/priority-change.c @@ -1,3 +1,7 @@ +/* Verifies that lowering a thread's priority so that it is no + longer the highest-priority thread in the system causes it to + yield immediately. */ + #include #include "tests/threads/tests.h" #include "threads/init.h" @@ -9,12 +13,12 @@ void test_priority_change (void) { /* This test does not work with the MLFQS. */ - ASSERT (!enable_mlfqs); + ASSERT (!thread_mlfqs); msg ("Creating a high-priority thread 2."); - thread_create ("thread 2", PRI_DEFAULT - 1, changing_thread, NULL); + thread_create ("thread 2", PRI_DEFAULT + 1, changing_thread, NULL); msg ("Thread 2 should have just lowered its priority."); - thread_set_priority (PRI_DEFAULT + 2); + thread_set_priority (PRI_DEFAULT - 2); msg ("Thread 2 should have just exited."); } @@ -22,6 +26,6 @@ static void changing_thread (void *aux UNUSED) { msg ("Thread 2 now lowering priority."); - thread_set_priority (PRI_DEFAULT + 1); + thread_set_priority (PRI_DEFAULT - 1); msg ("Thread 2 exiting."); }