mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-07-03 07:36:20 +00:00
Attempt to fix Linux
This commit is contained in:
parent
d0f427721c
commit
ecf2dbbb37
2 changed files with 10 additions and 4 deletions
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
|
|
||||||
Thread::Thread() : native_handle{nullptr} {}
|
Thread::Thread() : native_handle{0} {}
|
||||||
|
|
||||||
Thread::~Thread() {}
|
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);
|
native_handle = CreateThread(nullptr, 0, (LPTHREAD_START_ROUTINE)func, arg, 0, nullptr);
|
||||||
return native_handle ? 0 : -1;
|
return native_handle ? 0 : -1;
|
||||||
#else
|
#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_t pattr;
|
||||||
pthread_attr_init(&pattr);
|
pthread_attr_init(&pattr);
|
||||||
return pthread_create(pthr, &pattr, (PthreadFunc)func, arg);
|
return pthread_create(pthr, &pattr, (PthreadFunc)func, arg);
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "common/types.h"
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
|
|
||||||
class Thread {
|
class Thread {
|
||||||
|
@ -16,12 +18,16 @@ public:
|
||||||
int Create(ThreadFunc func, void* arg);
|
int Create(ThreadFunc func, void* arg);
|
||||||
void Exit();
|
void Exit();
|
||||||
|
|
||||||
void* GetHandle() {
|
uintptr_t GetHandle() {
|
||||||
return native_handle;
|
return reinterpret_cast<uintptr_t>(native_handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
#if _WIN64
|
||||||
void* native_handle;
|
void* native_handle;
|
||||||
|
#else
|
||||||
|
uintptr_t native_handle;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Core
|
} // namespace Core
|
Loading…
Add table
Add a link
Reference in a new issue