feat(thread): implement SThread::Create for windows

This commit is contained in:
fallenoak 2022-12-28 20:03:31 -06:00 committed by GitHub
parent 4dbfb0b3be
commit db87a5d782
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 41 additions and 6 deletions

View file

@ -3,8 +3,10 @@
int32_t SThread::Create(uint32_t (*threadProc)(void*), void* param, SThread& thread, char* threadName, uint32_t a5) {
#if defined(WHOA_SYSTEM_WIN)
// TODO implement
return 0;
uint32_t v8;
auto handle = SCreateThread(threadProc, param, &v8, nullptr, nullptr);
thread.m_opaqueData = handle;
return handle != nullptr;
#endif
#if defined(WHOA_SYSTEM_MAC) || defined(WHOA_SYSTEM_LINUX)
@ -13,6 +15,7 @@ int32_t SThread::Create(uint32_t (*threadProc)(void*), void* param, SThread& thr
pthread_cond_init(&thread.m_cond, nullptr);
uint32_t v8;
return SCreateThread(threadProc, param, &v8, &thread, nullptr) != 0;
auto handle = SCreateThread(threadProc, param, &v8, &thread, nullptr);
return handle != nullptr;
#endif
}

View file

@ -0,0 +1,6 @@
#include "storm/Thread.hpp"
void* SCreateThread(uint32_t (*threadProc)(void*), void* threadParam, void* a3, SThread* syncObject, const char* threadName) {
// TODO
return reinterpret_cast<void*>(1);
}

View file

@ -5,7 +5,7 @@
#include "storm/thread/mac/SThreadRunner.h"
#include <new>
int32_t SCreateThread(uint32_t (*threadProc)(void*), void* threadParam, void* a3, SThread* syncObject, const char* threadName) {
void* SCreateThread(uint32_t (*threadProc)(void*), void* threadParam, void* a3, SThread* syncObject, const char* threadName) {
if (!threadName) {
threadName = "";
}
@ -71,5 +71,5 @@ int32_t SCreateThread(uint32_t (*threadProc)(void*), void* threadParam, void* a3
// TODO
// S_Thread::s_threadCrit.Leave();
return threadId;
return reinterpret_cast<void*>(threadId);
}

View file

@ -0,0 +1,6 @@
#include "storm/Thread.hpp"
void* SCreateThread(uint32_t (*threadProc)(void*), void* threadParam, void* a3, SThread* syncObject, const char* threadName) {
// TODO
return reinterpret_cast<void*>(1);
}