Skip to content

Commit

Permalink
Attempt to fix Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
polybiusproxy committed Oct 30, 2024
1 parent b383394 commit 2457f9b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/core/thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace Core {

Thread::Thread() : native_handle{nullptr} {}
Thread::Thread() : native_handle{0} {}

Thread::~Thread() {}

Expand All @@ -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<pthread_t*>(native_handle);
pthread_t* pthr = reinterpret_cast<pthread_t*>(&native_handle);
pthread_attr_t pattr;
pthread_attr_init(&pattr);
return pthread_create(pthr, &pattr, (PthreadFunc)func, arg);
Expand Down
10 changes: 8 additions & 2 deletions src/core/thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

#pragma once

#include "common/types.h"

namespace Core {

class Thread {
Expand All @@ -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<uintptr_t>(native_handle);
}

private:
#if _WIN64
void* native_handle;
#else
uintptr_t native_handle;
#endif
};

} // namespace Core

0 comments on commit 2457f9b

Please sign in to comment.