Enderal SE https://mod.pub/enderal-se/38-enderal-se
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
642 B
33 lines
642 B
3 years ago
|
#pragma once
|
||
|
|
||
|
// TODO: I really don't like the interface for this
|
||
|
|
||
|
class IThread
|
||
|
{
|
||
|
public:
|
||
|
typedef void (* MainProcPtr)(void * param);
|
||
|
|
||
|
IThread();
|
||
|
~IThread();
|
||
|
|
||
|
void Start(MainProcPtr proc, void * procParam = NULL);
|
||
|
void Stop(void);
|
||
|
void ForceStop(void);
|
||
|
|
||
|
bool IsRunning(void) { return isRunning; }
|
||
|
bool StopRequested(void) { return stopRequested; }
|
||
|
|
||
|
HANDLE GetHandle(void) { return theThread; }
|
||
|
|
||
|
protected:
|
||
|
MainProcPtr mainProc;
|
||
|
void * mainProcParam;
|
||
|
volatile bool stopRequested;
|
||
|
bool isRunning;
|
||
|
HANDLE theThread;
|
||
|
UInt32 threadID;
|
||
|
|
||
|
private:
|
||
|
static UInt32 WINAPI _ThreadProc(void * param);
|
||
|
};
|