MDSTk Libraries  1.1.0
Medical Data Segmentation Toolkit
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Friends
mds::sys::CMutex Class Reference

Class providing simple mutual exclusion (recursive version). More...

#include <mdsMutex.h>

Inheritance diagram for mds::sys::CMutex:
Inheritance graph
[legend]

List of all members.

Public Types

enum  { CLASS_OBJECT }
 Templates that require members of the CObject class can use this enum to check the existence. More...
enum  { HEAP_OBJECT = 0x70616568 }
 Signature used to recognize objects on the heap. More...

Public Member Functions

 CMutex (bool bLocked=false)
 Constructor that creates a new mutex.
int getReferencesCount () const
 Returns the number of references.
bool isOnHeap () const
 Returns true if the object is allocated on the heap.
void lock ()
 Locks the mutex.
 MDS_SHAREDPTR (CMutex)
 Smart pointer type.
bool tryLock ()
 Tries to lock the mutex.
void unlock ()
 Releases ownership of the mutex.
virtual ~CMutex ()
 Destructor.

Static Public Member Functions

static void * operator new (std::size_t Size)
 Allocates a new object on the heap.

Protected Member Functions

void addReference () const
 Increase the reference counter.
bool delReference () const
 Decrease the reference counter.

Protected Attributes

int m_iHeapObject
 Flag initialized if the object is on the heap.
int m_iReferences
 The number of references to the object.

Friends

class CCondition

Detailed Description

Class providing simple mutual exclusion (recursive version).


Member Enumeration Documentation

anonymous enum [inherited]

Templates that require members of the CObject class can use this enum to check the existence.

Enumerator:
CLASS_OBJECT 
anonymous enum [inherited]

Signature used to recognize objects on the heap.

Enumerator:
HEAP_OBJECT 

Constructor & Destructor Documentation

mds::sys::CMutex::CMutex ( bool  bLocked = false)

Constructor that creates a new mutex.

virtual mds::sys::CMutex::~CMutex ( ) [virtual]

Destructor.


Member Function Documentation

void mds::base::CObject::addReference ( ) const [protected, inherited]

Increase the reference counter.

bool mds::base::CObject::delReference ( ) const [protected, inherited]

Decrease the reference counter.

  • Returns true if the decremented number of references is lower or equal to zero and object must be deleted.

Returns the number of references.

bool mds::base::CObject::isOnHeap ( ) const [inherited]

Returns true if the object is allocated on the heap.

Locks the mutex.

Smart pointer type.

static void* mds::base::CObject::operator new ( std::size_t  Size) [static, inherited]

Allocates a new object on the heap.

Tries to lock the mutex.

If it's already locked, returns immediately.

  • Returns true when obtained, false otherwise.

Releases ownership of the mutex.


Friends And Related Function Documentation

friend class CCondition [friend]

Member Data Documentation

int mds::base::CObject::m_iHeapObject [mutable, protected, inherited]

Flag initialized if the object is on the heap.

int mds::base::CObject::m_iReferences [mutable, protected, inherited]

The number of references to the object.

  • Zero if there is no reference.

The documentation for this class was generated from the following file: