00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef _SEM_H
00010 #define _SEM_H
00011
00012 #include <semaphore.h>
00013
00014 #include <cstdio>
00015 #include "ComPlusPlus/ShMem.h"
00016
00017 namespace compp {
00018 class Sem
00019 {
00020 protected:
00021 sem_t *SemIdP;
00022 sem_t SemId;
00023 ShMem *sm;
00024 public:
00025 Sem( bool remote = false, const int id = 0);
00026 Sem(int Val, bool remote = false, const int id = 0);
00027 virtual ~Sem();
00028 bool Post();
00029 bool Post(int count);
00030 bool Wait();
00031 bool TryWait();
00032 int Wait(int count);
00033 };
00034 }
00035 #endif