mirror of
https://github.com/thunderbrewhq/squall.git
synced 2025-12-12 10:32:29 +00:00
feat(thread): add thread functions
This commit is contained in:
parent
d0487caba3
commit
266bdc7737
16 changed files with 523 additions and 0 deletions
43
storm/thread/mac/S_Thread.mm
Normal file
43
storm/thread/mac/S_Thread.mm
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
#include "thread/S_Thread.hpp"
|
||||
#include "Memory.hpp"
|
||||
|
||||
uint32_t S_Thread::s_SLaunchThread(void* threadParam) {
|
||||
// TODO
|
||||
// SClearFP(1);
|
||||
|
||||
auto params = static_cast<SThreadParmBlock*>(threadParam);
|
||||
|
||||
// TODO
|
||||
// S_Thread::s_threadCrit.Enter();
|
||||
|
||||
// TODO
|
||||
// - something involving pthread_self()
|
||||
|
||||
// TODO
|
||||
// S_Thread::s_threadCrit.Leave();
|
||||
|
||||
// TODO
|
||||
// SErrAddFrameText("Calling thread proc %lx\n", params->threadProc);
|
||||
params->threadProc(params->threadParam);
|
||||
|
||||
// TODO
|
||||
// S_Thread::s_threadCrit.Enter();
|
||||
|
||||
// TODO
|
||||
// - remove tracking in S_Thread::s_threads
|
||||
// - decrement num threads
|
||||
|
||||
// TODO
|
||||
// S_Thread::s_threadCrit.Leave();
|
||||
|
||||
if (params->syncObject) {
|
||||
pthread_mutex_lock(¶ms->syncObject->m_mutex);
|
||||
params->syncObject->m_value = 1;
|
||||
pthread_mutex_unlock(¶ms->syncObject->m_mutex);
|
||||
pthread_cond_signal(¶ms->syncObject->m_cond);
|
||||
}
|
||||
|
||||
SMemFree(threadParam);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue