Adds CreateSemaphore/ReleaseSemaphore/WaitForSingleObject/CloseHandle/ SetThreadPriority/_beginthreadex to Win32Crt; port.file_loader_thread covers the shims, CThread and both the un-Created (40250 live) and Created loader. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
35 lines
716 B
C++
35 lines
716 B
C++
// 40250 EterLib/Thread.cpp, verbatim. The kernel32 calls resolve to the Win32Crt thread/semaphore/critical-section shims.
|
|
#include "EterLib/StdAfx.h"
|
|
#include "EterLib/Thread.h"
|
|
|
|
CThread::CThread() : m_pArg(NULL), m_hThread(NULL), m_uThreadID(0)
|
|
{
|
|
}
|
|
|
|
int CThread::Create(void * arg)
|
|
{
|
|
Arg(arg);
|
|
m_hThread = (HANDLE) _beginthreadex(NULL, 0, EntryPoint, this, 0, &m_uThreadID);
|
|
|
|
if (!m_hThread)
|
|
return false;
|
|
|
|
SetThreadPriority(m_hThread, THREAD_PRIORITY_NORMAL);
|
|
return true;
|
|
}
|
|
|
|
UINT CThread::Run(void * arg)
|
|
{
|
|
if (!Setup())
|
|
return 0;
|
|
|
|
return (Execute(arg));
|
|
}
|
|
|
|
/* Static */
|
|
UINT CALLBACK CThread::EntryPoint(void * pThis)
|
|
{
|
|
CThread * pThread = (CThread *) pThis;
|
|
return pThread->Run(pThread->Arg());
|
|
}
|