- "Testing multiple join.\n"
- "Threads 4 and 5 should finish before thread 6 starts.\n");
-
- tid4 = thread_create ("4", PRI_DEFAULT, simple_thread_func, "4");
- tid5 = thread_create ("5", PRI_DEFAULT, simple_thread_func, "5");
- thread_yield ();
- thread_join (tid4);
- thread_join (tid5);
- simple_thread_func ("6");
- printf ("Multiple join test done.\n");
+ "Testing priority donation.\n"
+ "If the statements printed below are all true, you pass.\n");
+
+ lock_init (&lock, "donor");
+ lock_acquire (&lock);
+ thread_create ("acquire1", PRI_DEFAULT + 1, acquire_thread_func, &lock);
+ printf ("This thread should have priority %d. Actual priority: %d.\n",
+ PRI_DEFAULT + 1, thread_get_priority ());
+ thread_create ("acquire2", PRI_DEFAULT + 2, acquire_thread_func, &lock);
+ printf ("This thread should have priority %d. Actual priority: %d.\n",
+ PRI_DEFAULT + 2, thread_get_priority ());
+ lock_release (&lock);
+ printf ("acquire2 and acquire1 must already have finished, in that order.\n"
+ "This should be the last line before finishing this test.\n"
+ "Priority donation test done.\n");