6 #define LMAXIMUMCOUNT 99999999 9 #warning POSIX will be used (but you did not define it) 11 #include <semaphore.h> 37 _sem = CreateSemaphore(0,in_init,LMAXIMUMCOUNT,0);
39 sem_init(&_sem,0,in_init);
50 _sem = CreateSemaphore(0,value,LMAXIMUMCOUNT,0);
52 sem_init(&_sem,0,value);
81 return WaitForSingleObject(static_cast< HANDLE >(_sem),INFINITE) == 0x00000000L;
83 return sem_wait(const_cast<sem_t*>(&_sem)) == 0;
93 return ReleaseSemaphore(static_cast< HANDLE >(_sem),1,0) != 0;
95 return sem_post(&_sem) == 0;
106 ReleaseSemaphore(static_cast<const HANDLE>(_sem),0,&value);
110 sem_getvalue(const_cast<sem_t*>(&_sem),&value);
122 _sem = CreateSemaphore(0,in_init,LMAXIMUMCOUNT,0);
125 sem_init(&_sem,0,in_init);
int value() const
get current value
Definition: Semaphore.hpp:103
Semaphore(int in_init=0)
Constructor.
Definition: Semaphore.hpp:35
different physics engine has different winding order.
Definition: EventBinding.h:32
bool wait() const
Wait until the semaphore is called by another thread.
Definition: Semaphore.hpp:79
void operator=(const Semaphore &in_sem)
Copy method.
Definition: Semaphore.hpp:60
Semaphore(const Semaphore &in_sem)
Copy constructor.
Definition: Semaphore.hpp:47
void reset(int in_init=0)
release current semaphore and create a new one
Definition: Semaphore.hpp:119
bool post()
post a token
Definition: Semaphore.hpp:91
cross platform condition variable.
Definition: Semaphore.hpp:21
Definition: enum_maker.hpp:46
virtual ~Semaphore()
destroy semaphore
Definition: Semaphore.hpp:67
sem_t _sem
Posix semaphore.
Definition: Semaphore.hpp:27