![]() |
InitializeSocketsNoMap() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Public Function |
Declared in: SpoofBase.h |
static BOOL InitializeSocketsNoMap( BOOL bMultiThreaded=TRUE, unsigned long ulNumberOfThreads=10);
Initialize the sockets, without requiring a message map bMultiThreaded - Do we want multithreaded support ulNumberOfThreads - Number of threads to allocate
//To avoid double initialize if (m_bInitialized) { //Report it ReportStaticError(CSpoofBase_Class,"InitializeSocketsNoMap","Already initialized!"); //Exit return TRUE; } //Check that the number of threads are OK? if (ulNumberOfThreads>CLibConfig::GetInstance().GetMaxThreads()) { //Report it ReportStaticError(CSpoofBase_Class,"InitializeSocketsNoMap","Too many threads!"); //Exit return FALSE; } //Do we have threads at all if (bMultiThreaded && !ulNumberOfThreads) { //Report it ReportStaticError(CSpoofBase_Class,"InitializeSocketsNoMap","Didn't receive any threads!"); //Exit return FALSE; } try { //Create the thread data ThreadData* pThreadData; pThreadData=new ThreadData; //Populate the data pThreadData->pEvent=COSManager::CreateEvent(); pThreadData->bMultiThreaded=bMultiThreaded; pThreadData->ulNumberOfThreads=ulNumberOfThreads; //Create the thread m_pThread=new CManagedThread(InitProc); m_pThread->Start((LPVOID)pThreadData); //Wait on the event if (pThreadData->pEvent->Wait(THREAD_TIMEOUT)) { //Report it ReportStaticError(CSpoofBase_Class,"InitializeSocketsNoMap","Timeout waiting for thread"); //Delete the thread delete m_pThread; m_pThread=NULL; //Exit return FALSE; } //Are we initialized if (!IsInitialized()) { //Delete the thread delete m_pThread; m_pThread=NULL; } //Done return IsInitialized(); } ERROR_HANDLER_STATIC_RETURN(CSpoofBase_Class,"InitializeSocketsNoMap",FALSE)
![]() |
Site content copyright © 2003 Komodia LTD.. See the About page for additional notices. This page last updated: 24 Feb 2003. |