mbo::CLockSingle Class Reference

Single-Lock implementation. More...

#include <MboSynch.h>

Inheritance diagram for mbo::CLockSingle:

Inheritance graph
{mbo::ILock\n||+ ~ILock()\l+ Enter()\l+ Leave()\l+ GetLevel()\l}
[legend]
Collaboration diagram for mbo::CLockSingle:

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

List of all members.

Public Member Functions

 CLockSingle (const ICriticalSection *pmx)
 CLockSingle (const CLockSingle &lx)
virtual ~CLockSingle ()
virtual void Enter () const
virtual void Leave () const
virtual unsigned long GetLevel () const


Detailed Description

Single-Lock implementation.

This Lock automatically calls Enter() upon creation and Leave() in destruction.

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

Definition at line 445 of file MboSynch.h.


Constructor & Destructor Documentation

mbo::CLockSingle::CLockSingle ( const ICriticalSection pmx  )  [inline, explicit]

constructor to allow selective call to Enter()

/*! default constructor which directly calls Enter()

Parameters:
pmx Mutex to use for Lock

Definition at line 456 of file MboSynch.h.

00459         : m_pmx(pmx)
00460     {
00461         assert(pmx);
00462         Enter();
00463     }

mbo::CLockSingle::CLockSingle ( const CLockSingle lx  )  [inline, explicit]

copy constructor

Ensure the lock is entered since the destructor will call Leave().

Definition at line 469 of file MboSynch.h.

00472         : m_pmx(lx.m_pmx)
00473     {
00474         Enter();
00475     }

virtual mbo::CLockSingle::~CLockSingle (  )  [inline, virtual]

destructor

Definition at line 479 of file MboSynch.h.

00480     {
00481         Leave();
00482     }


Member Function Documentation

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

enter the Lock

Implements mbo::ILock.

Definition at line 486 of file MboSynch.h.

00487     {
00488         m_pmx->Enter();
00489     }

virtual void mbo::CLockSingle::Leave (  )  const [inline, virtual]

leave the Lock

Implements mbo::ILock.

Definition at line 493 of file MboSynch.h.

00494     {
00495         m_pmx->Leave();
00496     }

virtual unsigned long mbo::CLockSingle::GetLevel (  )  const [inline, virtual]

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

This may not be correctly available in which case 1 is returned to signal Enter state.

Implements mbo::ILock.

Definition at line 499 of file MboSynch.h.

00500     {
00501         return m_pmx->GetLevel();
00502     }


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