Mutex Class Reference

Our implementation of mutex. More...

#include <mutex.h>

Inherited by InputManager.

Inheritance diagram for Mutex:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 Mutex ()
 inits m_mutex and m_rwlock
 ~Mutex ()
void lock ()
 Lock mutex.
void unlock ()
 Unlock mutex.

Protected Attributes

SDL_mutex * mSDLMutex
 SDL mutex. It is created in constructor and destoryed in destructor.

Detailed Description

Our implementation of mutex.

Implementation using SDL mutex. If creation of mutex fail the whole program may fall badly, because the error is logged. This is case of sigleton.s Usage is esay. Just use methods lock and unlock.

Note:
If you want to reimplement Mutex be sure that it use locking from SDL since our Thread class is using SDL threads. Or change both.

Definition at line 24 of file mutex.h.


Constructor & Destructor Documentation

Mutex::Mutex  ) 
 

inits m_mutex and m_rwlock

Definition at line 15 of file mutex.cpp.

References DIE(), LOGE, and mSDLMutex.

Here is the call graph for this function:

Mutex::~Mutex  ) 
 

Definition at line 28 of file mutex.cpp.

References mSDLMutex.


Member Function Documentation

void Mutex::lock  ) 
 

Lock mutex.

Die on error.

Definition at line 34 of file mutex.cpp.

References DIE(), LOGE, and mSDLMutex.

Referenced by Commander::addCommand(), Console::addConsoleMessage(), GameServer::getMapName(), Thread::getStop(), TimeManager::getTicks(), Thread::isRunning(), Game::isRunning(), InputManager::keyDown(), Thread::needWait(), Commander::processAllCommands(), InputManager::processKeys(), Console::render(), GameServer::setMapName(), Thread::setRunning(), Game::setRunning(), Thread::setStop(), Thread::start(), Thread::wait(), and InputManager::WantAllInput().

Here is the call graph for this function:

void Mutex::unlock  ) 
 

Unlock mutex.

Die on error.

Definition at line 44 of file mutex.cpp.

References DIE(), LOGE, and mSDLMutex.

Referenced by Commander::addCommand(), GameServer::getMapName(), Thread::getStop(), TimeManager::getTicks(), Thread::isRunning(), Game::isRunning(), InputManager::keyDown(), Thread::needWait(), Commander::processAllCommands(), InputManager::processKeys(), GameServer::setMapName(), Thread::setRunning(), Game::setRunning(), Thread::setStop(), Thread::start(), Thread::wait(), and InputManager::WantAllInput().

Here is the call graph for this function:


Member Data Documentation

SDL_mutex* Mutex::mSDLMutex [protected]
 

SDL mutex. It is created in constructor and destoryed in destructor.

Definition at line 45 of file mutex.h.

Referenced by lock(), Mutex(), unlock(), and ~Mutex().


The documentation for this class was generated from the following files:
Generated on Wed Apr 12 14:20:17 2006 for bjs by  doxygen 1.4.5