Class CThreadPool::
ClearThreads()
Base ClassesData ItemsConstructorsDestructorsFunctionsCustom CodeGo to hierarchy chart    Prev page: ClearNext page: CThreadPool    Show member index
Private Function Declared in:
ThreadPool.h

'Declaration' icon -- Shortcut to top of page. Declaration

void ClearThreads();

'Description' icon -- Shortcut to top of page. Description

delete all the threads

'Function Body' icon -- Shortcut to top of page. 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' icon -- Shortcut to top of page. See Also

Class Overview Class Overview  |  Public base class CErrorHandler  |  Hierarchy Chart Hierarchy Chart


Get Surveyor!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.