mirror of
https://github.com/thunderbrewhq/squall.git
synced 2025-12-12 10:32:29 +00:00
feat(thread): add SSyncObject destructor
This commit is contained in:
parent
8521485e49
commit
e5fe4a7e19
2 changed files with 20 additions and 0 deletions
|
|
@ -12,6 +12,25 @@ SSyncObject::SSyncObject() {
|
|||
#endif
|
||||
}
|
||||
|
||||
SSyncObject::~SSyncObject() {
|
||||
#if defined(WHOA_SYSTEM_WIN)
|
||||
this->Close();
|
||||
#endif
|
||||
|
||||
#if defined(WHOA_SYSTEM_MAC) || defined(WHOA_SYSTEM_LINUX)
|
||||
pthread_mutex_destroy(&this->m_mutex);
|
||||
#endif
|
||||
}
|
||||
|
||||
void SSyncObject::Close() {
|
||||
#if defined(WHOA_SYSTEM_WIN)
|
||||
if (this->m_opaqueData) {
|
||||
CloseHandle(this->m_opaqueData);
|
||||
this->m_opaqueData = nullptr;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool SSyncObject::Valid() {
|
||||
#if defined(WHOA_SYSTEM_WIN)
|
||||
return this->m_opaqueData != nullptr;
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ class SSyncObject {
|
|||
|
||||
// Member functions
|
||||
SSyncObject();
|
||||
~SSyncObject();
|
||||
void Close();
|
||||
bool Valid();
|
||||
uint32_t Wait(uint32_t timeoutMs);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue