#include #include #include //For SST_WAIT_INFINITE ZSemaphore::ZSemaphore(int _initialCount) : Semaphore(SST_Concurrency_CreateSemaphore(_initialCount)) { ZASSERT_RUNTIME(Semaphore != NULL, "ZSemaphore failed to allocate semaphore from libsst-concurrency!"); } ZSemaphore::~ZSemaphore() { } void ZSemaphore::Post() { SST_Concurrency_PostSemaphore(Semaphore, 1); } void ZSemaphore::Post( uint32_t _count ) { SST_Concurrency_PostSemaphore(Semaphore, _count); } bool ZSemaphore::Wait() { return SST_Concurrency_WaitSemaphore(Semaphore, SST_WAIT_INFINITE) != 0; } bool ZSemaphore::Wait( uint32_t _ms ) { return SST_Concurrency_WaitSemaphore(Semaphore, _ms) != 0; }