OpenDaVINCI  4.15.3
odcore::base::Mutex Class Reference

#include <Mutex.h>

Inheritance diagram for odcore::base::Mutex:
Inheritance graph

Public Member Functions

 Mutex ()
 
virtual ~Mutex ()
 

Protected Member Functions

virtual void lock ()
 
virtual bool tryLock ()
 
virtual void unlock ()
 

Friends

class Lock
 

Detailed Description

This class implements a mutex for protecting parts of the code for simultaneous access using the concept of scoped locks:

// Declaration elsewhere.
...
{
Lock l(m);
// Critical part.
}
...

If a mutex gets destroyed it will be unlocked before automatically!

Constructor & Destructor Documentation

odcore::base::Mutex::Mutex ( )
odcore::base::Mutex::~Mutex ( )
virtual

References tryLock(), and unlock().

Member Function Documentation

void odcore::base::Mutex::lock ( )
protectedvirtual

This method locks this mutex.

Reimplemented in odcore::base::Condition.

Referenced by odcore::base::Lock::Lock().

bool odcore::base::Mutex::tryLock ( )
protectedvirtual

This method tries to lock this mutex.

Returns
true, if the mutex could be locked.

Reimplemented in odcore::base::Condition.

Referenced by ~Mutex().

void odcore::base::Mutex::unlock ( )
protectedvirtual

This method unlocks this mutex.

Reimplemented in odcore::base::Condition.

Referenced by odcore::base::Lock::~Lock(), and ~Mutex().

Friends And Related Function Documentation

friend class Lock
friend