X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Ftests%2Fthreads%2Fpriority-donate-multiple.c;h=df4689cecc602a17bc6dfbe183dd23504a8970b1;hb=f4651c01a134759e3dc904960f96d568e6855a4f;hp=836f3ed028f62785d0f36fcbe52a9f4a8b149421;hpb=7665c366dc222ad23602e34324907f27596186ba;p=pintos-anon diff --git a/src/tests/threads/priority-donate-multiple.c b/src/tests/threads/priority-donate-multiple.c index 836f3ed..df4689c 100644 --- a/src/tests/threads/priority-donate-multiple.c +++ b/src/tests/threads/priority-donate-multiple.c @@ -1,4 +1,10 @@ -/* Based on a test originally submitted for Stanford's CS 140 in +/* The main thread acquires locks A and B, then it creates two + higher-priority threads. Each of these threads blocks + acquiring one of the locks and thus donate their priority to + the main thread. The main thread releases the locks in turn + and relinquishes its donated priorities. + + Based on a test originally submitted for Stanford's CS 140 in winter 1999 by Matt Franklin , Greg Hutchins , Yu Ping Hu . Modified by arens. */ @@ -18,7 +24,7 @@ test_priority_donate_multiple (void) struct lock a, b; /* This test does not work with the MLFQS. */ - ASSERT (!enable_mlfqs); + ASSERT (!thread_mlfqs); /* Make sure our priority is the default. */ ASSERT (thread_get_priority () == PRI_DEFAULT); @@ -29,18 +35,18 @@ test_priority_donate_multiple (void) lock_acquire (&a); lock_acquire (&b); - thread_create ("a", PRI_DEFAULT - 1, a_thread_func, &a); + thread_create ("a", PRI_DEFAULT + 1, a_thread_func, &a); msg ("Main thread should have priority %d. Actual priority: %d.", - PRI_DEFAULT - 1, thread_get_priority ()); + PRI_DEFAULT + 1, thread_get_priority ()); - thread_create ("b", PRI_DEFAULT - 2, b_thread_func, &b); + thread_create ("b", PRI_DEFAULT + 2, b_thread_func, &b); msg ("Main thread should have priority %d. Actual priority: %d.", - PRI_DEFAULT - 2, thread_get_priority ()); + PRI_DEFAULT + 2, thread_get_priority ()); lock_release (&b); msg ("Thread b should have just finished."); msg ("Main thread should have priority %d. Actual priority: %d.", - PRI_DEFAULT - 1, thread_get_priority ()); + PRI_DEFAULT + 1, thread_get_priority ()); lock_release (&a); msg ("Thread a should have just finished.");