You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
712 B
C
29 lines
712 B
C
|
12 years ago
|
#pragma once
|
||
|
|
#include "Utility.h"
|
||
|
|
|
||
|
|
class UTILITYDLL CThread
|
||
|
|
{
|
||
|
|
// friend DWORD WINAPI MyThreadFunction( LPVOID lpParam );
|
||
|
|
friend UINT __cdecl MyThreadFunction( LPVOID lpParam );
|
||
|
|
private:
|
||
|
|
HANDLE m_threadHandle;
|
||
|
|
CWinThread *m_pWinThread;
|
||
|
|
DWORD m_threadId;
|
||
|
|
const char* m_threadName;
|
||
|
|
CEvt m_eventStarted;
|
||
|
|
void _Run();
|
||
|
|
bool bIsInterrupted;
|
||
|
|
public:
|
||
|
|
CThread(const char* threadName);
|
||
|
|
virtual ~CThread(void);
|
||
|
|
virtual void Run() = 0;
|
||
|
|
bool Start();
|
||
|
|
bool Wait(DWORD dwMilliSeconds=INFINITE);
|
||
|
|
bool WaitStarted(DWORD dwMilliSeconds=INFINITE);
|
||
|
|
DWORD GetThreadId();
|
||
|
|
HANDLE GetThreadHandle();
|
||
|
|
const char* GetName() { return m_threadName; }
|
||
|
|
void Interrupt();
|
||
|
|
bool IsInterrupted();
|
||
|
|
};
|