00001 // this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*- 00002 //---------------------------------------------------------------------- 00012 //---------------------------------------------------------------------- 00013 #ifndef ICL_CORE_THREAD_SEMAPHORE_IMPL_POSIX_H_INCLUDED 00014 #define ICL_CORE_THREAD_SEMAPHORE_IMPL_POSIX_H_INCLUDED 00015 00016 #include <semaphore.h> 00017 00018 #include <icl_core/BaseTypes.h> 00019 00020 #include "icl_core_thread/SemaphoreImpl.h" 00021 00022 namespace icl_core { 00023 namespace thread { 00024 00025 class SemaphoreImplPosix : public SemaphoreImpl, protected virtual icl_core::Noncopyable 00026 { 00027 public: 00028 SemaphoreImplPosix(size_t initial_value); 00029 virtual ~SemaphoreImplPosix(); 00030 00031 virtual void post(); 00032 virtual bool tryWait(); 00033 virtual bool wait(); 00034 virtual bool wait(const icl_core::TimeSpan& timeout); 00035 virtual bool wait(const icl_core::TimeStamp& timeout); 00036 00037 private: 00038 sem_t *m_semaphore; 00039 }; 00040 00041 } 00042 } 00043 00044 #endif