00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef __XVR2_SEMAPHORE_H__
00015 #define __XVR2_SEMAPHORE_H__
00016
00017 #include<xvr2/Threading.h>
00018 #include<xvr2/CoreExceptions.h>
00019 #ifdef USE_POSIX_THREADS
00020 #include<semaphore.h>
00021 #endif
00022
00023 namespace xvr2{
00028 class Semaphore:public Threading{
00029 private:
00030 #ifdef USE_POSIX_THREADS
00031 sem_t __sem;
00032 #endif
00033 protected:
00034 void init(int x);
00035 void destroy();
00036 public:
00037 Semaphore(int x);
00038 ~Semaphore();
00039 void wait();
00040 void trywait();
00041 void post();
00042 void getvalue(int *x);
00043 };
00044 }
00045
00046 #endif