1 /* Verifies that lowering a thread's priority so that it is no
2 longer the highest-priority thread in the system causes it to
6 #include "tests/threads/tests.h"
7 #include "threads/init.h"
8 #include "threads/thread.h"
10 static thread_func changing_thread;
13 test_priority_change (void)
15 /* This test does not work with the MLFQS. */
16 ASSERT (!thread_mlfqs);
18 msg ("Creating a high-priority thread 2.");
19 thread_create ("thread 2", PRI_DEFAULT + 1, changing_thread, NULL);
20 msg ("Thread 2 should have just lowered its priority.");
21 thread_set_priority (PRI_DEFAULT - 2);
22 msg ("Thread 2 should have just exited.");
26 changing_thread (void *aux UNUSED)
28 msg ("Thread 2 now lowering priority.");
29 thread_set_priority (PRI_DEFAULT - 1);
30 msg ("Thread 2 exiting.");