void CThread::StopThread(bool bWait /*= true*/) { m_bStop = true; SetEvent(m_StopEvent); if (m_ThreadHandle && bWait) { WaitForThreadExit(INFINITE); CloseHandle(m_ThreadHandle); m_ThreadHandle = NULL; } }
void CThread::StopThread(bool bWait /*= true*/) { m_bStop = true; m_StopEvent.Set(); CSingleLock lock(m_CriticalSection); if (m_ThreadId && bWait) { lock.Leave(); WaitForThreadExit(0xFFFFFFFF); } }