2 #include "tests/threads/tests.h"
3 #include "threads/init.h"
4 #include "threads/malloc.h"
5 #include "threads/synch.h"
6 #include "threads/thread.h"
7 #include "devices/timer.h"
9 static thread_func priority_sema_thread;
10 static struct semaphore sema;
13 test_priority_sema (void)
17 /* This test does not work with the MLFQS. */
18 ASSERT (!enable_mlfqs);
21 thread_set_priority (PRI_MAX);
22 for (i = 0; i < 10; i++)
24 int priority = (i + 3) % 10 + PRI_DEFAULT + 1;
26 snprintf (name, sizeof name, "priority %d", priority);
27 thread_create (name, priority, priority_sema_thread, NULL);
30 for (i = 0; i < 10; i++)
33 msg ("Back in main thread.");
38 priority_sema_thread (void *aux UNUSED)
41 msg ("Thread %s woke up.", thread_name ());