Skip to content

Commit

Permalink
feat(thread): add SSyncObject::Valid
Browse files Browse the repository at this point in the history
  • Loading branch information
fallenoak authored Oct 16, 2022
1 parent 8a90f86 commit 9607293
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions storm/thread/SSyncObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@ SSyncObject::SSyncObject() {
#endif
}

bool SSyncObject::Valid() {
#if defined(WHOA_SYSTEM_WIN)
return this->m_opaqueData != nullptr;
#endif

#if defined(WHOA_SYSTEM_MAC) || defined(WHOA_SYSTEM_LINUX)
return this->int0 - 1 <= 4;
#endif
}

uint32_t SSyncObject::Wait(uint32_t timeoutMs) {
#if defined(WHOA_SYSTEM_WIN)
return WaitForSingleObject(this->m_opaqueData, timeoutMs);
Expand Down
2 changes: 1 addition & 1 deletion storm/thread/SSyncObject.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class SSyncObject {
// Member functions
SSyncObject();
void Close(void);
bool Valid(void);
bool Valid();
uint32_t Wait(uint32_t timeoutMs);
};

Expand Down

0 comments on commit 9607293

Please sign in to comment.