11 Attach(lpExternalRoutine);
15 if ( m_ThreadCtx.m_hThread )
20 m_ThreadCtx.m_pUserData = arg;
21 m_ThreadCtx.m_hThread = CreateThread(NULL, 0, m_pThreadStartRoutine,
this, 0, &m_ThreadCtx.m_dwTID);
22 m_ThreadCtx.m_dwExitCode = (DWORD)-1;
24 return GetLastError();
28 if ( m_ThreadCtx.m_hThread )
30 GetExitCodeThread(m_ThreadCtx.m_hThread, &m_ThreadCtx.m_dwExitCode);
32 if ( m_ThreadCtx.m_dwExitCode == STILL_ACTIVE && bForceKill )
33 TerminateThread(m_ThreadCtx.m_hThread, DWORD(-1));
35 m_ThreadCtx.m_hThread = NULL;
38 return m_ThreadCtx.m_dwExitCode;
42 if ( m_ThreadCtx.m_hThread )
43 GetExitCodeThread(m_ThreadCtx.m_hThread, (LPDWORD)&m_ThreadCtx.m_dwExitCode);
44 return m_ThreadCtx.m_dwExitCode;
48 m_pThreadStartRoutine = lpThreadStartRoutine;
57 if(!pParent)
return STILL_ACTIVE;
DWORD Stop(bool bForceKill=false)
raThreadContext m_ThreadCtx
virtual void ThreadDtor()
virtual void ThreadCtor()
void Attach(LPTHREAD_START_ROUTINE lpThreadStartRoutine)
static DWORD WINAPI EntryPoint(LPVOID pArg)
virtual DWORD Run(LPVOID arg)
DWORD Start(void *arg=NULL)
DWORD GetExitCode() const