Main Page | Alphabetical List | Class List | File List | Class Members | File Members

SynchList Class Reference

#include <synchlist.h>

List of all members.

Public Member Functions

 SynchList ()
 ~SynchList ()
void Append (void *item)
void * Remove ()
void Mapcar (VoidFunctionPtr func)


Constructor & Destructor Documentation

SynchList::SynchList  ) 
 

Definition at line 25 of file synchlist.cc.

00026 { 00027 list = new List(); 00028 lock = new Lock("list lock"); 00029 listEmpty = new Condition("list empty cond"); 00030 }

SynchList::~SynchList  ) 
 

Definition at line 37 of file synchlist.cc.

00038 { 00039 delete list; 00040 delete lock; 00041 delete listEmpty; 00042 }


Member Function Documentation

void SynchList::Append void *  item  ) 
 

Definition at line 54 of file synchlist.cc.

References Lock::Acquire(), List::Append(), Lock::Release(), and Condition::Signal().

00055 { 00056 lock->Acquire(); // enforce mutual exclusive access to the list 00057 list->Append(item); 00058 listEmpty->Signal(lock); // wake up a waiter, if any 00059 lock->Release(); 00060 }

void SynchList::Mapcar VoidFunctionPtr  func  ) 
 

Definition at line 93 of file synchlist.cc.

References Lock::Acquire(), List::Mapcar(), Lock::Release(), and VoidFunctionPtr.

00094 { 00095 lock->Acquire(); 00096 list->Mapcar(func); 00097 lock->Release(); 00098 }

void * SynchList::Remove  ) 
 

Definition at line 71 of file synchlist.cc.

References Lock::Acquire(), ASSERT, List::IsEmpty(), Lock::Release(), List::Remove(), and Condition::Wait().

00072 { 00073 void *item; 00074 00075 lock->Acquire(); // enforce mutual exclusion 00076 while (list->IsEmpty()) 00077 listEmpty->Wait(lock); // wait until list isn't empty 00078 item = list->Remove(); 00079 ASSERT(item != NULL); 00080 lock->Release(); 00081 return item; 00082 }


The documentation for this class was generated from the following files:
Generated on Thu Sep 16 12:33:49 2004 for NachOS by doxygen 1.3.8