00001 #ifndef PHX_SEMAPHORE_H
00002 #define PHX_SEMAPHORE_H
00003
00004 #include <Phx/PhxConfig.h>
00005 #include <Phx/PhxTypes.h>
00006
00016 #if HAVE_SEMAPHORE_H
00017 #include <semaphore.h>
00018 #else
00019 #error semaphore.h not found.
00020 #endif
00021
00022 namespace Phx {
00023
00034 class Semaphore {
00035 public:
00036
00046 Semaphore(uint32_t initialValue = 0);
00047
00048 ~Semaphore();
00049
00050
00058 void signal(void);
00059
00070 void wait(void);
00071
00072 int value(void) { int v; sem_getvalue(&mSem, &v); return v; }
00073 private:
00074 sem_t mSem;
00075 };
00076
00077 };
00078
00079 #endif