28 for (i = 0; i < 10; i++)
36 for (i = 0; i < 10; i++)
#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.
int snprintf(char *buffer, size_t buf_size, const char *format,...)
Like printf(), except that output is stored into BUFFER, which must have space for BUF_SIZE character...
void msg(const char *format,...)
void test_priority_condvar(void)
static thread_func priority_condvar_thread
Tests that cond_signal() wakes up the highest-priority thread waiting in cond_wait().
void lock_release(struct lock *lock)
Releases LOCK, which must be owned by the current thread.
void cond_wait(struct condition *cond, struct lock *lock)
Atomically releases LOCK and waits for COND to be signaled by some other piece of code.
void cond_signal(struct condition *cond, struct lock *lock UNUSED)
If any threads are waiting on COND (protected by LOCK), then this function signals one of them to wak...
void lock_init(struct lock *lock)
Initializes LOCK.
void lock_acquire(struct lock *lock)
Acquires LOCK, sleeping until it becomes available if necessary.
void cond_init(struct condition *cond)
Initializes condition variable COND.
bool thread_mlfqs
If false (default), use round-robin scheduler.
const char * thread_name(void)
Returns the name of the running thread.
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...
void thread_set_priority(int new_priority)
Sets the current thread's priority to NEW_PRIORITY.
#define PRI_DEFAULT
Default priority.
void thread_func(void *aux)
#define PRI_MIN
Thread priorities.