2021-09-03 05:11:04 +00:00
|
|
|
#include <windows.h>
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
class CScriptInstance;
|
|
|
|
|
|
|
|
class CScriptWorker
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
bool m_bStopping;
|
|
|
|
bool m_bRegistered;
|
2022-09-26 02:31:54 +00:00
|
|
|
static DWORD WINAPI ThreadProc(void * _this);
|
2021-09-03 05:11:04 +00:00
|
|
|
|
|
|
|
public:
|
2022-09-26 02:31:54 +00:00
|
|
|
CScriptWorker(CScriptInstance * instance, void * dukObjectHeapPtr);
|
2021-09-03 05:11:04 +00:00
|
|
|
virtual ~CScriptWorker();
|
|
|
|
void StartWorkerProc();
|
|
|
|
virtual void StopWorkerProc();
|
|
|
|
|
|
|
|
protected:
|
2022-09-26 02:31:54 +00:00
|
|
|
CScriptInstance * m_Instance;
|
|
|
|
void * m_DukObjectHeapPtr;
|
|
|
|
CriticalSection m_CS;
|
|
|
|
HANDLE m_hThread;
|
2021-09-03 05:11:04 +00:00
|
|
|
|
|
|
|
// Implementation should return when StopRequested() is true
|
|
|
|
virtual void WorkerProc() = 0;
|
|
|
|
bool StopRequested();
|
|
|
|
};
|