diff --git a/src/core/thread.cpp b/src/core/thread.cpp index 355367d87d..e9c46b5229 100644 --- a/src/core/thread.cpp +++ b/src/core/thread.cpp @@ -11,7 +11,7 @@ namespace Core { -Thread::Thread() : native_handle{nullptr} {} +Thread::Thread() : native_handle{0} {} Thread::~Thread() {} @@ -20,7 +20,7 @@ int Thread::Create(ThreadFunc func, void* arg) { native_handle = CreateThread(nullptr, 0, (LPTHREAD_START_ROUTINE)func, arg, 0, nullptr); return native_handle ? 0 : -1; #else - pthread_t* pthr = reinterpret_cast(native_handle); + pthread_t* pthr = reinterpret_cast(&native_handle); pthread_attr_t pattr; pthread_attr_init(&pattr); return pthread_create(pthr, &pattr, (PthreadFunc)func, arg); diff --git a/src/core/thread.h b/src/core/thread.h index b1d25c693b..8665100af3 100644 --- a/src/core/thread.h +++ b/src/core/thread.h @@ -3,6 +3,8 @@ #pragma once +#include "common/types.h" + namespace Core { class Thread { @@ -16,12 +18,16 @@ class Thread { int Create(ThreadFunc func, void* arg); void Exit(); - void* GetHandle() { - return native_handle; + uintptr_t GetHandle() { + return reinterpret_cast(native_handle); } private: +#if _WIN64 void* native_handle; +#else + uintptr_t native_handle; +#endif }; } // namespace Core \ No newline at end of file