45 msg (
"Main thread should have priority %d. Actual priority: %d.",
51 msg (
"Main thread should have priority %d. Actual priority: %d.",
55 msg (
"Main thread should have priority %d. Actual priority: %d.",
59 msg (
"Threads b, a, c should have just finished, in that order.");
60 msg (
"Main thread should have priority %d. Actual priority: %d.",
70 msg (
"Thread a acquired lock a.");
72 msg (
"Thread a finished.");
81 msg (
"Thread b acquired lock b.");
83 msg (
"Thread b finished.");
89 msg (
"Thread c finished.");
#define ASSERT(CONDITION)
This is outside the header guard so that debug.h may be included multiple times with different settin...
#define UNUSED
GCC lets us add "attributes" to functions, function parameters, etc.
void msg(const char *format,...)
static thread_func c_thread_func
static thread_func a_thread_func
The main thread acquires locks A and B, then it creates three higher-priority threads.
static thread_func b_thread_func
void test_priority_donate_multiple2(void)
void lock_release(struct lock *lock)
Releases LOCK, which must be owned by the current thread.
void lock_init(struct lock *lock)
Initializes LOCK.
void lock_acquire(struct lock *lock)
Acquires LOCK, sleeping until it becomes available if necessary.
bool thread_mlfqs
If false (default), use round-robin scheduler.
int thread_get_priority(void)
Returns the current thread's priority.
tid_t thread_create(const char *name, int priority, thread_func *function, void *aux)
Creates a new kernel thread named NAME with the given initial PRIORITY, which executes FUNCTION passi...
#define PRI_DEFAULT
Default priority.
void thread_func(void *aux)