From 4f670845ff9ab6c48bcb5f7bf4d4ef6dc3c3064b Mon Sep 17 00:00:00 2001 From: manuel Date: Tue, 27 Mar 2012 11:51:08 +0200 Subject: reorganize file structure to match the upstream requirements --- pintos-progos/tests/threads/priority-donate-one.c | 65 ----------------------- 1 file changed, 65 deletions(-) delete mode 100644 pintos-progos/tests/threads/priority-donate-one.c (limited to 'pintos-progos/tests/threads/priority-donate-one.c') diff --git a/pintos-progos/tests/threads/priority-donate-one.c b/pintos-progos/tests/threads/priority-donate-one.c deleted file mode 100644 index 3189f3a..0000000 --- a/pintos-progos/tests/threads/priority-donate-one.c +++ /dev/null @@ -1,65 +0,0 @@ -/* 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 , - Greg Hutchins , Yu Ping Hu - . Modified by arens. */ - -#include -#include "tests/threads/tests.h" -#include "threads/init.h" -#include "threads/synch.h" -#include "threads/thread.h" - -static thread_func acquire1_thread_func; -static thread_func acquire2_thread_func; - -void -test_priority_donate_one (void) -{ - struct lock lock; - - /* This test does not work with the MLFQS. */ - ASSERT (!thread_mlfqs); - - /* Make sure our priority is the default. */ - ASSERT (thread_get_priority () == PRI_DEFAULT); - - lock_init (&lock); - lock_acquire (&lock); - thread_create ("acquire1", PRI_DEFAULT + 1, acquire1_thread_func, &lock); - msg ("This thread should have priority %d. Actual priority: %d.", - PRI_DEFAULT + 1, thread_get_priority ()); - thread_create ("acquire2", PRI_DEFAULT + 2, acquire2_thread_func, &lock); - msg ("This thread should have priority %d. Actual priority: %d.", - PRI_DEFAULT + 2, thread_get_priority ()); - lock_release (&lock); - msg ("acquire2, acquire1 must already have finished, in that order."); - msg ("This should be the last line before finishing this test."); -} - -static void -acquire1_thread_func (void *lock_) -{ - struct lock *lock = lock_; - - lock_acquire (lock); - msg ("acquire1: got the lock"); - lock_release (lock); - msg ("acquire1: done"); -} - -static void -acquire2_thread_func (void *lock_) -{ - struct lock *lock = lock_; - - lock_acquire (lock); - msg ("acquire2: got the lock"); - lock_release (lock); - msg ("acquire2: done"); -} -- cgit v1.2.3