|
|
@ -46,9 +46,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com |
|
|
|
|
|
|
|
|
|
|
|
typedef uint32_t hsMilliseconds; |
|
|
|
typedef uint32_t hsMilliseconds; |
|
|
|
|
|
|
|
|
|
|
|
#ifdef HS_BUILD_FOR_WIN32 |
|
|
|
#ifdef HS_BUILD_FOR_UNIX |
|
|
|
# include "hsWindows.h" |
|
|
|
|
|
|
|
#elif defined(HS_BUILD_FOR_UNIX) |
|
|
|
|
|
|
|
#include <pthread.h> |
|
|
|
#include <pthread.h> |
|
|
|
#include <semaphore.h> |
|
|
|
#include <semaphore.h> |
|
|
|
// We can't wait with a timeout with semas
|
|
|
|
// We can't wait with a timeout with semas
|
|
|
@ -64,7 +62,7 @@ class hsThread |
|
|
|
{ |
|
|
|
{ |
|
|
|
public: |
|
|
|
public: |
|
|
|
#if HS_BUILD_FOR_WIN32 |
|
|
|
#if HS_BUILD_FOR_WIN32 |
|
|
|
typedef DWORD ThreadId; |
|
|
|
typedef uint32_t ThreadId; |
|
|
|
#elif HS_BUILD_FOR_UNIX |
|
|
|
#elif HS_BUILD_FOR_UNIX |
|
|
|
typedef pthread_t ThreadId; |
|
|
|
typedef pthread_t ThreadId; |
|
|
|
#endif |
|
|
|
#endif |
|
|
@ -88,7 +86,7 @@ public: |
|
|
|
virtual ~hsThread(); // calls Stop()
|
|
|
|
virtual ~hsThread(); // calls Stop()
|
|
|
|
#if HS_BUILD_FOR_WIN32 |
|
|
|
#if HS_BUILD_FOR_WIN32 |
|
|
|
ThreadId GetThreadId() { return fThreadId; } |
|
|
|
ThreadId GetThreadId() { return fThreadId; } |
|
|
|
static ThreadId GetMyThreadId() { return GetCurrentThreadId(); } |
|
|
|
static ThreadId GetMyThreadId(); |
|
|
|
#elif HS_BUILD_FOR_UNIX |
|
|
|
#elif HS_BUILD_FOR_UNIX |
|
|
|
ThreadId GetThreadId() { return fPThread; } |
|
|
|
ThreadId GetThreadId() { return fPThread; } |
|
|
|
static ThreadId GetMyThreadId() { return pthread_self(); } |
|
|
|
static ThreadId GetMyThreadId() { return pthread_self(); } |
|
|
@ -204,13 +202,7 @@ public: |
|
|
|
class hsSleep |
|
|
|
class hsSleep |
|
|
|
{ |
|
|
|
{ |
|
|
|
public: |
|
|
|
public: |
|
|
|
#if HS_BUILD_FOR_UNIX |
|
|
|
|
|
|
|
static void Sleep(uint32_t millis); |
|
|
|
static void Sleep(uint32_t millis); |
|
|
|
|
|
|
|
|
|
|
|
#elif HS_BUILD_FOR_WIN32 |
|
|
|
|
|
|
|
static void Sleep(uint32_t millis) { ::Sleep(millis); } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|