IBR-DTNSuite  0.8
ibrcommon/ibrcommon/thread/MutexLock.cpp
Go to the documentation of this file.
00001 #include "ibrcommon/config.h"
00002 #include "ibrcommon/thread/MutexLock.h"
00003 
00004 namespace ibrcommon
00005 {
00006         MutexLock::MutexLock(MutexInterface &m) : m_mutex(m)
00007         {
00008                 m_mutex.enter();
00009         }
00010 
00011         MutexLock::~MutexLock()
00012         {
00013                 m_mutex.leave();
00014         }
00015 
00016         MutexTryLock::MutexTryLock(MutexInterface &m) : m_mutex(m)
00017         {
00018                 m_mutex.trylock();
00019         }
00020 
00021         MutexTryLock::~MutexTryLock()
00022         {
00023                 m_mutex.leave();
00024         }
00025 
00026         IndicatingLock::IndicatingLock(MutexInterface &m, bool &indicator)
00027          : MutexLock(m), _indicator(indicator)
00028         {
00029                 _indicator = true;
00030         }
00031 
00032         IndicatingLock::~IndicatingLock()
00033         {
00034                 _indicator = false;
00035         }
00036 }