![]() |
CleanThreads() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Private Function |
Declared in: SocketThreadManager.h |
void CleanThreads( BOOL bError);
Delete the thread structure
try { //Our wait list CWaitList aList; //Start deleting if (m_pThreadData) { //Our counter int iCounter; //Delete the threads for (iCounter=0;iCounter<m_ulThreadCount;++iCounter) //Post a stop message if (m_pThreadData[iCounter].pThread->GetThreadID()) { //Send the message PostThreadMessage(m_pThreadData[iCounter].pThread->GetThreadID(),WM_QUIT,0,0); //Are we nice or not ? if (bError) //Delete the window DestroyWindow(m_pThreadData[iCounter].hWindowHandle); else if (m_pThreadData[iCounter].pEvent) aList.AddObject(m_pThreadData[iCounter].pEvent,TRUE); } //Error or not ? if (bError) //Sleep to allow the threads to quit Sleep(1000); else { //Tmp object DWORD dwTmp; //Wait for threads if (aList.Wait(TRUE,dwTmp,THREADS_TIMEOUT)) ReportError("CleanThreads","Timeout waiting for threads!"); } //Delete the thread classes for (iCounter=0;iCounter<m_ulThreadCount;++iCounter) { //And delete the thread delete m_pThreadData[iCounter].pThread; //Delete the CS delete m_pThreadData[iCounter].pCSection; //Delete the event delete m_pThreadData[iCounter].pEvent; //Are we nice or not ? if (!bError) //Delete the window DestroyWindow(m_pThreadData[iCounter].hWindowHandle); } //Delete the structure delete [] m_pThreadData; } } ERROR_HANDLER("CleanThreads")
![]() |
Site content copyright © 2003 Komodia LTD.. See the About page for additional notices. This page last updated: 24 Feb 2003. |