Fix ld output with recent versions of GCC and binutils
[pintos-anon] / src / tests / threads / priority-donate-nest.c
index b1ee690422371070f2f5f51a160d6f449f4d4440..3a3a9a590a2b677031524ad351f6e20e88216b8d 100644 (file)
@@ -1,10 +1,13 @@
-/* Problem 1-3: Priority Scheduling tests.
-
+/* Low-priority main thread L acquires lock A.  Medium-priority
+   thread M then acquires lock B then blocks on acquiring lock A.
+   High-priority thread H then blocks on acquiring lock B.  Thus,
+   thread H donates its priority to M, which in turn donates it
+   to thread L.
+   
    Based on a test originally submitted for Stanford's CS 140 in
-   winter 1999 by by Matt Franklin
-   <startled@leland.stanford.edu>, Greg Hutchins
-   <gmh@leland.stanford.edu>, Yu Ping Hu <yph@cs.stanford.edu>.
-   Modified by arens. */
+   winter 1999 by Matt Franklin <startled@leland.stanford.edu>,
+   Greg Hutchins <gmh@leland.stanford.edu>, Yu Ping Hu
+   <yph@cs.stanford.edu>.  Modified by arens. */
 
 #include <stdio.h>
 #include "tests/threads/tests.h"
@@ -28,7 +31,7 @@ test_priority_donate_nest (void)
   struct locks locks;
 
   /* 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);
@@ -40,15 +43,15 @@ test_priority_donate_nest (void)
 
   locks.a = &a;
   locks.b = &b;
-  thread_create ("medium", PRI_DEFAULT - 1, medium_thread_func, &locks);
+  thread_create ("medium", PRI_DEFAULT + 1, medium_thread_func, &locks);
   thread_yield ();
   msg ("Low thread should have priority %d.  Actual priority: %d.",
-       PRI_DEFAULT - 1, thread_get_priority ());
+       PRI_DEFAULT + 1, thread_get_priority ());
 
-  thread_create ("high", PRI_DEFAULT - 2, high_thread_func, &b);
+  thread_create ("high", PRI_DEFAULT + 2, high_thread_func, &b);
   thread_yield ();
   msg ("Low thread should have priority %d.  Actual priority: %d.",
-       PRI_DEFAULT - 2, thread_get_priority ());
+       PRI_DEFAULT + 2, thread_get_priority ());
 
   lock_release (&a);
   thread_yield ();
@@ -66,7 +69,7 @@ medium_thread_func (void *locks_)
   lock_acquire (locks->a);
 
   msg ("Medium thread should have priority %d.  Actual priority: %d.",
-       PRI_DEFAULT - 2, thread_get_priority ());
+       PRI_DEFAULT + 2, thread_get_priority ());
   msg ("Medium thread got the lock.");
 
   lock_release (locks->a);