SemaphoreImplLxrt38.cpp
Go to the documentation of this file.
00001 // this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*-
00002 //----------------------------------------------------------------------
00008 //----------------------------------------------------------------------
00009 #include "SemaphoreImplLxrt38.h"
00010 
00011 namespace icl_core {
00012 namespace logging {
00013 
00014 SemaphoreImplLxrt38::SemaphoreImplLxrt38(size_t initial_value)
00015   : m_semaphore(NULL)
00016 {
00017   m_semaphore = rt_typed_sem_init(size_t(this), initial_value, CNT_SEM | PRIO_Q);
00018 }
00019 
00020 SemaphoreImplLxrt38::~SemaphoreImplLxrt38()
00021 {
00022   if (m_semaphore == NULL)
00023   {
00024     // Nothing to be done here!
00025   }
00026   else
00027   {
00028     rt_sem_delete(m_semaphore);
00029     m_semaphore = NULL;
00030   }
00031 }
00032 
00033 void SemaphoreImplLxrt38::post()
00034 {
00035   rt_sem_signal(m_semaphore);
00036 }
00037 
00038 bool SemaphoreImplLxrt38::wait()
00039 {
00040   int res = rt_sem_wait(m_semaphore);
00041   return (res < SEM_TIMOUT);
00042 }
00043 
00044 }
00045 }


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