CS318 - Pintos
Pintos source browser for JHU CS318 course
Functions | Variables
priority-donate-one.c File Reference
#include <stdio.h>
#include "tests/threads/tests.h"
#include "threads/init.h"
#include "threads/synch.h"
#include "threads/thread.h"
Include dependency graph for priority-donate-one.c:

Go to the source code of this file.

Functions

void test_priority_donate_one (void)
 
static void acquire1_thread_func (void *lock_)
 
static void acquire2_thread_func (void *lock_)
 

Variables

static thread_func acquire1_thread_func
 The main thread acquires a lock. More...
 
static thread_func acquire2_thread_func
 

Function Documentation

◆ acquire1_thread_func()

static void acquire1_thread_func ( void *  lock_)
static

Definition at line 46 of file priority-donate-one.c.

References lock_acquire(), lock_release(), and msg().

Here is the call graph for this function:

◆ acquire2_thread_func()

static void acquire2_thread_func ( void *  lock_)
static

Definition at line 57 of file priority-donate-one.c.

References lock_acquire(), lock_release(), and msg().

Here is the call graph for this function:

◆ test_priority_donate_one()

void test_priority_donate_one ( void  )

Variable Documentation

◆ acquire1_thread_func

thread_func acquire1_thread_func
static

The main thread acquires a lock.

Then it creates two higher-priority threads that block acquiring the lock, causing them to donate their priorities to the main thread. When the main thread releases the lock, the other threads should acquire it in priority order.

Based on a test originally submitted for Stanford's CS 140 in winter 1999 by Matt Franklin start.nosp@m.led@.nosp@m.lelan.nosp@m.d.st.nosp@m.anfor.nosp@m.d.ed.nosp@m.u, Greg Hutchins gmh@l.nosp@m.elan.nosp@m.d.sta.nosp@m.nfor.nosp@m.d.edu, Yu Ping Hu yph@c.nosp@m.s.st.nosp@m.anfor.nosp@m.d.ed.nosp@m.u. Modified by arens.

Definition at line 18 of file priority-donate-one.c.

Referenced by test_priority_donate_one().

◆ acquire2_thread_func

thread_func acquire2_thread_func
static

Definition at line 19 of file priority-donate-one.c.

Referenced by test_priority_donate_one().