10 #include <processthreadsapi.h>
15 #if defined(EHS_OS_WINDOWS)
16 #define EHS_INVALID_THREAD nullptr
17 typedef void* THandle;
18 #elif defined(EHS_OS_LINUX)
19 #define EHS_INVALID_THREAD 0
20 typedef UInt_64 THandle;
29 static Handle mainTaskHdl;
47 Thread(
const UInt_64 stackSize = 0);
93 void SetTaskType_32(
const Str_32& task);
98 void SetTaskType_16(
const Str_16& task);
103 void SetTaskType_8(
const Str_8& task);
105 void RevertTaskType();
115 #ifdef EHS_OS_WINDOWS
119 static void SetMainTaskType_32(
const Str_32& task);
124 static void SetMainTaskType_16(
const Str_16& task);
129 static void SetMainTaskType_8(
const Str_8& task);
131 static void RevertMainTaskType();
146 static void* Redirect(
void* args);
#define EHS_INFINITE
Definition Types.h:35
void Start(UInt_32(*cb)(void *), void *args)
Definition Thread.cpp:58
bool IsValid() const
Definition Thread.cpp:145
static float HardSleepFor(const float seconds)
Definition Thread.cpp:250
static UInt_64 GetCurrentId()
Definition Thread.cpp:198
UInt_32 GetId() const
Definition Thread.cpp:135
THandle GetHandle() const
Definition Thread.cpp:130
static UInt_32 GetMainId()
Gets the main thread id.
Definition Thread.cpp:193
Thread & operator=(const Thread &thread)
Definition Thread.cpp:41
static void SleepFor(const UInt_32 miliseconds)
Definition Thread.cpp:261
bool IsCurrent() const
Definition Thread.cpp:140
UInt_64 GetStackSize() const
Definition Thread.cpp:125
bool Join(const unsigned int timeout=EHS_INFINITE)
Definition Thread.cpp:73
void Detach()
Detaches the referenced thread, removing ownership.
Definition Thread.cpp:107
Thread(const UInt_64 stackSize=0)
Default members initialization.
Definition Thread.cpp:25
unsigned int UInt_32
Definition Types.h:49
Str< Char_16, UInt_64 > Str_16
Definition Str.h:1901
Str< Char_8, UInt_64 > Str_8
Definition Str.h:1902
Str< Char_32, UInt_64 > Str_32
Definition Str.h:1900