mbo::IMutex Class Reference

Mutex Interface. More...

#include <MboSynch.h>

Inheritance diagram for mbo::IMutex:

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

Collaboration graph
{mbo::ICriticalSection\n||+ ~ICriticalSection()\l+ Enter()\l+ Leave()\l+ GetLock()\l+ GetLevel()\l}
[legend]

List of all members.

Public Member Functions

virtual void Enter () const
virtual bool Try (DWORD nMilliseconds=0) const =0
virtual CLock GetLock () const =0

Protected Member Functions

virtual HANDLE GetHandle () const
virtual IncDecVal IncEntered () const =0
virtual IncDecVal DecEntered () const =0

Friends

class MutexList


Detailed Description

Mutex Interface.

Internally derived classes must implement a counter for the times Enter() and Leave() are called respectively. This counter must be controlled by the interface build from IncEntered() and DecEntered().

Note:
No derived class must base Leave() calls on the number of times Enter() was called. Not even based on the interface described above.

As a direct consequence the user must ensure that for every successfull call to Enter() exactly one call to Leave() is performed.

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

Definition at line 377 of file MboSynch.h.


Member Function Documentation

virtual void mbo::IMutex::Enter (  )  const [inline, virtual]

Enter Mutex

Implements mbo::ICriticalSection.

Reimplemented in mbo::CMutexImpl, mbo::CMutexFake, and mbo::MutexList.

Definition at line 383 of file MboSynch.h.

00383 { while (!Try(INFINITE)); }

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

Try to enter the Mutex

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

Implemented in mbo::CMutexImpl, mbo::CMutexFake, and mbo::MutexList.

virtual CLock mbo::IMutex::GetLock (  )  const [pure 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::ICriticalSection.

Implemented in mbo::CMutexImpl, mbo::CMutexFake, and mbo::MutexList.

virtual HANDLE mbo::IMutex::GetHandle (  )  const [inline, protected, virtual]

Returns:
internally used HANDLE

Reimplemented in mbo::CMutexImpl.

Definition at line 408 of file MboSynch.h.

00408 { return INVALID_HANDLE_VALUE; }

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

Inform that the Mutex was entered.

Implemented in mbo::CMutexImpl, mbo::CMutexFake, and mbo::MutexList.

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

Inform that the Mutex was leaved.

Implemented in mbo::CMutexImpl, mbo::CMutexFake, and mbo::MutexList.


Friends And Related Function Documentation

friend class MutexList [friend]

grant MutexList access

Definition at line 379 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:12 2008 for MBO-lib by doxygen 1.5.4