Class CManagedThread::
Start()
Base ClassesData ItemsConstructorsDestructorsFunctionsCustom CodeGo to hierarchy chart    Prev page: SetThreadTimeoutNext page: Stop    Show member index
Public Function Declared in:
ManagedThread.h

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

BOOL Start(
    LPVOID lpData);

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

Start the thread lpData - Custome user data to pass to the thread

'Function Body' icon -- Shortcut to top of page. Function Body

try
{
    //Are we running
    if (m_pEnterEvent ||
        m_pExitEvent)
    {
        //Report it
        ReportError("Start","Already running!");

        //Exit
        return FALSE;
    }

    //Create all
    m_pEnterEvent=COSManager::CreateEvent();
    m_pExitEvent=COSManager::CreateEvent();

    //Save the user data
    m_lpData=lpData;

    //Set it to auto delete
    m_pThread->SetAutoDelete(TRUE);

    //Run the thread
    m_pThread->Start((LPVOID)this);

    //Wait for the event
    if (m_pEnterEvent->Wait(m_dwThreadTimeout))
    {
        //Report it
        ReportError("Start","Timeout waiting for thread!");

        //Delete it all
        delete m_pThread;
        m_pThread=COSManager::CreateThread(ManagedThread);

        //The events
        delete m_pEnterEvent;
        m_pEnterEvent=NULL;

        delete m_pExitEvent;
        m_pExitEvent=NULL;

        //Exit
        return FALSE;
    }
    else
        return TRUE;
}
ERROR_HANDLER_RETURN("Start",FALSE)

'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.