Class CSpoofBase::
InitProc()
Base ClassesData ItemsConstructorsDestructorsFunctionsCustom CodeGo to hierarchy chart    Prev page: InitializeSocketsNoMapNext page: IsInitialized    Show member index
Private Function Declared in:
SpoofBase.h

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

static DWORD InitProc(
    CGenericEvent* pExitEvent,
    LPVOID lpData);

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

Our thread proc

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

try
{
    //Our data
    std::auto_ptr<ThreadData> pThreadData((ThreadData*)lpData);

    //Try to initialize the sockets
    BOOL bResult;
    bResult=InitializeSockets(pThreadData->bMultiThreaded,
                              pThreadData->ulNumberOfThreads);

    //Signal the event
    pThreadData->pEvent->Set();

    //Do we need to run a loop?
    if (bResult)
    {
        //Yes run a message loop
        MSG msg;

        //Set the message map to zeros
        memset(&msg,
               0,
               sizeof(msg));

        //Stop flag
        BOOL bRun;
        bRun=TRUE;

        //Start the loop
        while (bRun &&
               pExitEvent->Wait(0))
        {
            while ((bRun=pExitEvent->Wait(0)) &&
                   PeekMessage(&msg,
                               NULL,
                               0,
                               0,
                               PM_REMOVE))
            {
                TranslateMessage(&msg);
                DispatchMessage(&msg);
            }

            //Do we need to sleep?
            if (bRun)
                //No messages
                bRun=pExitEvent->Wait(1);
        }
    }

    //Done
    return TRUE;
}
ERROR_HANDLER_STATIC_RETURN(CSpoofBase_Class,"InitProc",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.