![]() |
ClearThreads() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
| Private Function |
Declared in: ThreadPool.h |
Declarationvoid ClearThreads();
Descriptiondelete all the threads
Function Body
try
{
//Do we have brute delete
if (m_bInitialized)
{
//Our waiting list
CWaitList aList;
//Wait for all the threads to exit
for (int iCount=0;iCount<m_ulThreadCount;iCount++)
{
//Add the exit event
aList.AddObject(m_ppThreadData[iCount]->pEvent,TRUE);
//Signal the exit
m_ppThreadData[iCount]->pExitEvent->Set();
}
//Wait for them
DWORD dwTmp;
if (aList.Wait(TRUE,dwTmp,THREAD_TIMEOUT))
//Report the error
ReportError("ClearThreads","Timeout waiting for threads!");
}
//Clear all
for (int iCount=0;iCount<m_ulThreadCount;iCount++)
{
//Delete the thread
delete m_ppThreads[iCount];
//Delete the events
delete m_ppThreadData[iCount]->pEvent;
delete m_ppThreadData[iCount]->pExitEvent;
//Delete the data
delete m_ppThreadData[iCount];
}
//Delete the array
delete [] m_ppThreads;
delete [] m_ppThreadData;
//Clear them
m_ppThreads=NULL;
m_ppThreadData=NULL;
}
ERROR_HANDLER("ClearThreads")
See Also
This web site was generated
using Surveyor V4.50.811.1. Click
here
for more information. |
Site content copyright © 2003 Komodia LTD.. See the About page for additional notices. This page last updated: 24 Feb 2003. |