Main Page   Packages   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Search  

Lock Class Reference

#include <Lock.hpp>

List of all members.

Public Methods

 Lock (Mutex &mutex, bool autoLock=true)
virtual ~Lock ()
void get ()
void release ()
void wait ()
void notify ()
void notifyAll ()

Private Methods

 Lock ()
 Lock (const Lock &)
Lock & operator= (Lock &)

Private Attributes

Mutexmutex
bool locked


Constructor & Destructor Documentation

Lock::Lock Mutex   mutex,
bool    autoLock = true
 

Lock::~Lock   [virtual]
 

Definition at line 13 of file Lock.cpp.

00013             {
00014   release();
00015 }

Lock::Lock   [private]
 

Lock::Lock const Lock &    [private]
 


Member Function Documentation

void Lock::get  
 

Definition at line 17 of file Lock.cpp.

00017                {
00018   if (!locked) {
00019     mutex.lock();
00020     locked = TRUE;
00021   }
00022 }

void Lock::notify  
 

Definition at line 39 of file Lock.cpp.

00039                   {
00040   if (!locked) {
00041     cout << "Notify on an unlocked mutex.\n";
00042   }
00043 
00044   mutex.notify();
00045 }

void Lock::notifyAll  
 

Definition at line 47 of file Lock.cpp.

00047                      {
00048   if (!locked) {
00049     cout << "NotifyAll on an unlocked mutex.\n";
00050   }
00051 
00052   mutex.notifyAll();
00053 }

Lock& Lock::operator= Lock &    [private]
 

void Lock::release  
 

Definition at line 24 of file Lock.cpp.

Referenced by ~Lock().

00024                    {
00025   if (locked) {
00026     mutex.unlock();
00027     locked = FALSE;
00028   }
00029 }

void Lock::wait  
 

Definition at line 31 of file Lock.cpp.

00031                 {
00032   if (!locked) {
00033     cout << "Waiting on an unlocked mutex.\n";
00034   }
00035 
00036   mutex.wait();
00037 }


Member Data Documentation

bool Lock::locked [private]
 

Definition at line 65 of file Lock.hpp.

Mutex& Lock::mutex [private]
 

Definition at line 64 of file Lock.hpp.


The documentation for this class was generated from the following files:
Generated on Sun Oct 14 18:49:14 2001 for Standard J2K Library by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001