00001 #ifndef N2NC_SYNCSEMAPHORE_H 00002 #define N2NC_SYNCSEMAPHORE_H 00003 00004 #include "nixsys.h" 00005 00006 namespace n2nc { 00007 namespace sync { 00008 00014 class Semaphore{ 00015 public: 00016 Semaphore(uint init_value = 0); 00017 ~Semaphore(); 00018 int getValue(); 00019 bool tryWait(); 00020 bool wait(); 00021 bool post(); 00022 00023 private: 00024 sem_t m_sem ; 00025 00026 }; 00027 00028 } 00029 00030 } 00031 00032 #endif