ScopedMutexLock.cpp
Go to the documentation of this file.
00001 // this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*-
00002 //----------------------------------------------------------------------
00009 //----------------------------------------------------------------------
00010 #include "icl_core_thread/ScopedMutexLock.h"
00011 
00012 #include "icl_core_thread/Mutex.h"
00013 
00014 namespace icl_core {
00015 namespace thread {
00016 
00017 ScopedMutexLock::ScopedMutexLock(Mutex& mutex, bool force)
00018   : m_mutex(mutex), m_is_locked(false)
00019 {
00020   do
00021   {
00022     m_is_locked = m_mutex.lock();
00023   }
00024   while (force && !m_is_locked);
00025 }
00026 
00027 ScopedMutexLock::~ScopedMutexLock()
00028 {
00029   if (isLocked())
00030   {
00031     m_mutex.unlock();
00032   }
00033 }
00034 
00036 #ifdef _IC_BUILDER_DEPRECATED_STYLE_
00037 
00041 bool ScopedMutexLock::IsLocked() const
00042 {
00043   return isLocked();
00044 }
00045 
00046 #endif
00047 
00048 
00049 }
00050 }


schunk_svh_driver
Author(s): Georg Heppner
autogenerated on Fri Aug 28 2015 12:59:19