X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Ftests%2Fthreads%2Fpriority-sema.c;h=d7eb9cc076cfbaf26f9a174ff1503dcdb24d6d1a;hb=606adbdcd2294fa780081cf2c88ff949d7cca152;hp=743b05aecd4907140054f83f60dbd520ca467e16;hpb=615bf3b3d2a8573ed6fb9ddc0055745e163ac999;p=pintos-anon diff --git a/src/tests/threads/priority-sema.c b/src/tests/threads/priority-sema.c index 743b05a..d7eb9cc 100644 --- a/src/tests/threads/priority-sema.c +++ b/src/tests/threads/priority-sema.c @@ -1,3 +1,6 @@ +/* Tests that the highest-priority thread waiting on a semaphore + is the first to wake up. */ + #include #include "tests/threads/tests.h" #include "threads/init.h" @@ -18,10 +21,10 @@ test_priority_sema (void) ASSERT (!enable_mlfqs); sema_init (&sema, 0); - thread_set_priority (PRI_MAX); + thread_set_priority (PRI_MIN); for (i = 0; i < 10; i++) { - int priority = (i + 3) % 10 + PRI_DEFAULT + 1; + int priority = PRI_DEFAULT - (i + 3) % 10 - 1; char name[16]; snprintf (name, sizeof name, "priority %d", priority); thread_create (name, priority, priority_sema_thread, NULL);