23 #include "copyright.h" 45 Semaphore (
const char *debugName,
int initialValue);
47 const char *getName ()
76 Lock (
const char *debugName);
78 const char *getName ()
86 bool isHeldByCurrentThread ();
94 Thread * currentThreadHolding = NULL;
95 List * WaitingForLock;
137 const char *getName ()
142 void Wait (
Lock * conditionLock);
146 void Signal (
Lock * conditionLock);
147 void Broadcast (
Lock * conditionLock);
The following class defines a "thread control block" – which represents a single thread of execution...
Definition: thread.h:79
Data structures for managing threads.
Routines to manage a singly-linked list of "things". Defining TRUE and FALSE is usually a Bad Idea...
The following class defines a "semaphore" whose value is a non-negative integer. The semaphore has on...
Definition: synch.h:42
~Semaphore()
Semaphore::Semaphore De-allocate semaphore, when no longer needed. Assume no one is still waiting on ...
Definition: synch.cc:52
void P()
Semaphore::P Wait until semaphore value > 0, then decrement. Checking the value and decrementing must...
Definition: synch.cc:68
void V()
Semaphore::V Increment semaphore value, waking up a waiter if necessary. As with P(), this operation must be atomic, so we need to disable interrupts. Scheduler::ReadyToRun() assumes that threads are disabled when it is called.
Definition: synch.cc:98
Semaphore(const char *debugName, int initialValue)
Semaphore::Semaphore Initialize a semaphore, so that it can be used for synchronization.
Definition: synch.cc:39