mbo::CMutexImpl Class Reference

Mutex implementation. More...

#include <MboSynch.h>

Inheritance diagram for mbo::CMutexImpl:

Inheritance graph
{mbo::IMutex\n||+ Enter()\l+ Try()\l+ GetLock()\l# GetHandle()\l# IncEntered()\l# DecEntered()\l}{mbo::ICriticalSection\n||+ ~ICriticalSection()\l+ Enter()\l+ Leave()\l+ GetLock()\l+ GetLevel()\l}
[legend]
Collaboration diagram for mbo::CMutexImpl:

Collaboration graph
{mbo::IMutex\n||+ Enter()\l+ Try()\l+ GetLock()\l# GetHandle()\l# IncEntered()\l# DecEntered()\l}{mbo::ICriticalSection\n||+ ~ICriticalSection()\l+ Enter()\l+ Leave()\l+ GetLock()\l+ GetLevel()\l}
[legend]

List of all members.

Public Member Functions

 CMutexImpl ()
virtual ~CMutexImpl ()
virtual void Enter () const
virtual void Leave () const
virtual bool Try (DWORD nMilliseconds=0) const
virtual CLock GetLock () const
virtual HANDLE GetHandle () const
virtual unsigned long GetLevel () const

Protected Member Functions

virtual IncDecVal IncEntered () const
virtual IncDecVal DecEntered () const

Protected Attributes

IncDecVal m_lEntered


Detailed Description

Mutex implementation.

This is a wrapper for WIN-API functions and thus invokes functions with a HANDLE.

Note:
This class is distributed under the following license GNU Lesser General Public License, version 2.1.

Definition at line 978 of file MboSynch.h.


Constructor & Destructor Documentation

mbo::CMutexImpl::CMutexImpl (  ) 

Default constructor

virtual mbo::CMutexImpl::~CMutexImpl (  )  [virtual]

Destructor frees internal resources.


Member Function Documentation

virtual void mbo::CMutexImpl::Enter (  )  const [virtual]

wait for mutex to be owned and increment ownership counter

Reimplemented from mbo::IMutex.

virtual void mbo::CMutexImpl::Leave (  )  const [virtual]

decrement ownership of mutex and release if ownership counter has value 0.

Implements mbo::ICriticalSection.

virtual bool mbo::CMutexImpl::Try ( DWORD  nMilliseconds = 0  )  const [virtual]

Try to enter the mutex and return true if entered false if not.

Returns:
When the mutex was entered the return value is true.
Parameters:
nMilliseconds time to try to enter in milliseconds
Returns:
whether or not the mutex was entered

Implements mbo::IMutex.

virtual CLock mbo::CMutexImpl::GetLock (  )  const [virtual]

Get lock for this mutex

The created lock will be returned as an object. That requires full return by value and invoking copy operators. But that is the only possible solution since we need a local copy that will be destructed locally - the sense of the lock.

Returns:
Lock for this Mutex

Implements mbo::IMutex.

virtual HANDLE mbo::CMutexImpl::GetHandle (  )  const [virtual]

Internal function used to get the internally used HANDLE.

Returns:
internally used HANDLE

Reimplemented from mbo::IMutex.

virtual unsigned long mbo::CMutexImpl::GetLevel (  )  const [virtual]

Returns:
Number of times CriticalSection is entered
Note:
This is only valie when the CriticalSection/Mutex is owned by the current thread.

Implements mbo::ICriticalSection.

virtual IncDecVal mbo::CMutexImpl::IncEntered (  )  const [protected, virtual]

Inform that the Mutex was entered.

Implements mbo::IMutex.

virtual IncDecVal mbo::CMutexImpl::DecEntered (  )  const [protected, virtual]

Inform that the Mutex was leaved.

Implements mbo::IMutex.


Member Data Documentation

IncDecVal mbo::CMutexImpl::m_lEntered [mutable, protected]

number of times Mutex was entered

Definition at line 1031 of file MboSynch.h.


The documentation for this class was generated from the following file:
  Hosted on code.google.com  
© Marcus Börger
Generated on Fri Jan 18 21:21:13 2008 for MBO-lib by doxygen 1.5.4