mirror of
https://github.com/thunderbrewhq/squall.git
synced 2025-12-12 02:22:30 +00:00
feat(thread): add SSemaphore
This commit is contained in:
parent
83cd9b05c0
commit
6437796094
3 changed files with 29 additions and 0 deletions
15
storm/thread/SSemaphore.cpp
Normal file
15
storm/thread/SSemaphore.cpp
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
#include "storm/thread/SSemaphore.hpp"
|
||||
|
||||
SSemaphore::SSemaphore(uint32_t initialCount, uint32_t maximumCount)
|
||||
: SSyncObject() {
|
||||
#if defined(WHOA_SYSTEM_WIN)
|
||||
this->m_opaqueData = CreateSemaphoreA(nullptr, initialCount, maximumCount, nullptr);
|
||||
#endif
|
||||
|
||||
#if defined(WHOA_SYSTEM_MAC) || defined(WHOA_SYSTEM_LINUX)
|
||||
this->m_value1 = initialCount;
|
||||
this->m_value2 = maximumCount;
|
||||
this->int0 = 4;
|
||||
pthread_cond_init(&this->m_cond, 0);
|
||||
#endif
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue