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/threads/synch.h | 51 ------------------------------------------- 1 file changed, 51 deletions(-) delete mode 100644 pintos-progos/threads/synch.h (limited to 'pintos-progos/threads/synch.h') diff --git a/pintos-progos/threads/synch.h b/pintos-progos/threads/synch.h deleted file mode 100644 index a19e88b..0000000 --- a/pintos-progos/threads/synch.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef THREADS_SYNCH_H -#define THREADS_SYNCH_H - -#include -#include - -/* A counting semaphore. */ -struct semaphore - { - unsigned value; /* Current value. */ - struct list waiters; /* List of waiting threads. */ - }; - -void sema_init (struct semaphore *, unsigned value); -void sema_down (struct semaphore *); -bool sema_try_down (struct semaphore *); -void sema_up (struct semaphore *); -void sema_self_test (void); - -/* Lock. */ -struct lock - { - struct thread *holder; /* Thread holding lock (for debugging). */ - struct semaphore semaphore; /* Binary semaphore controlling access. */ - }; - -void lock_init (struct lock *); -void lock_acquire (struct lock *); -bool lock_try_acquire (struct lock *); -void lock_release (struct lock *); -bool lock_held_by_current_thread (const struct lock *); - -/* Condition variable. */ -struct condition - { - struct list waiters; /* List of waiting threads. */ - }; - -void cond_init (struct condition *); -void cond_wait (struct condition *, struct lock *); -void cond_signal (struct condition *, struct lock *); -void cond_broadcast (struct condition *, struct lock *); - -/* Optimization barrier. - - The compiler will not reorder operations across an - optimization barrier. See "Optimization Barriers" in the - reference guide for more information.*/ -#define barrier() asm volatile ("" : : : "memory") - -#endif /* threads/synch.h */ -- cgit v1.2.3