2020-09-09 00:45:46 -05:00
|
|
|
#ifndef STORM_THREAD_S_SYNC_OBJECT_HPP
|
|
|
|
|
#define STORM_THREAD_S_SYNC_OBJECT_HPP
|
|
|
|
|
|
|
|
|
|
#include <cstdint>
|
|
|
|
|
|
2020-11-24 17:29:31 -06:00
|
|
|
#if defined(WHOA_PLATFORM_MAC) || defined(WHOA_PLATFORM_LINUX)
|
2020-09-09 00:45:46 -05:00
|
|
|
#include <pthread.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
class SSyncObject {
|
|
|
|
|
public:
|
|
|
|
|
// Member variables
|
2020-11-24 17:29:31 -06:00
|
|
|
#if defined(WHOA_PLATFORM_WIN)
|
2020-09-09 00:45:46 -05:00
|
|
|
HANDLE m_opaqueData = nullptr;
|
|
|
|
|
#endif
|
|
|
|
|
|
2020-11-24 17:29:31 -06:00
|
|
|
#if defined(WHOA_PLATFORM_MAC) || defined(WHOA_PLATFORM_LINUX)
|
2020-09-09 00:45:46 -05:00
|
|
|
int32_t m_int0 = 6;
|
|
|
|
|
int32_t m_value;
|
|
|
|
|
pthread_cond_t m_cond;
|
|
|
|
|
pthread_mutex_t m_mutex;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
// Member functions
|
|
|
|
|
SSyncObject();
|
|
|
|
|
void Close(void);
|
|
|
|
|
bool Valid(void);
|
|
|
|
|
uint32_t Wait(uint32_t timeoutMs);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif
|