ScopedSemaphore.cpp
Go to the documentation of this file.
00001 // this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*-
00002 //----------------------------------------------------------------------
00009 //----------------------------------------------------------------------
00010 
00011 #include "icl_core_logging/ScopedSemaphore.h"
00012 #include "icl_core_logging/Semaphore.h"
00013 
00014 namespace icl_core {
00015 namespace logging {
00016 
00017 ScopedSemaphore::ScopedSemaphore(Semaphore& semaphore)
00018   : m_semaphore(semaphore),
00019     m_is_decremented(false)
00020 {
00021   if (m_semaphore.wait())
00022   {
00023     m_is_decremented = true;
00024   }
00025 }
00026 
00027 ScopedSemaphore::~ScopedSemaphore()
00028 {
00029   if (isDecremented())
00030   {
00031     m_semaphore.post();
00032   }
00033 }
00034 
00036 #ifdef _IC_BUILDER_DEPRECATED_STYLE_
00037 
00041 bool ScopedSemaphore::IsDecremented() const
00042 {
00043   return isDecremented();
00044 }
00045 
00046 #endif
00047 
00048 
00049 }
00050 }


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