void OsclDNSRequest::Activate(DNSRequestParam* p, OsclDNSRequestAO &a) //activate a dns request { //make sure we don't have multiple requests... //calling logic should prevent this, but just in case. if (iActive) a.PendComplete(OSCL_REQUEST_ERR_GENERAL); p->iDNSRequest = this; iDNSRequestAO = &a; iDNSRequestParam = p; iActive = true; #if(PV_DNS_IS_THREAD) //launch the thread. OsclThread thread; OsclProcStatus::eOsclProcError err = thread.Create( (TOsclThreadFuncPtr)ThreadFunc, 1024, (TOsclThreadFuncArg)p); if (err == OsclProcStatus::SUCCESS_ERROR) { //Wait on the thread to start p->iStartup.Wait(); } else { iDNSRequestAO->PendComplete(OSCL_REQUEST_ERR_GENERAL); } //the request is completed under the DNS thread. #else //non-threaded implementation. //call the thread routine directly-- this call blocks. PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, a.iLogger, PVLOGMSG_NOTICE, (0, "PVOSCLIO:OsclDNSRequest:Issuing blocking call to DNS...")); ((DNSRequestParam*)p)->InThread(); PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, a.iLogger, PVLOGMSG_NOTICE, (0, "PVOSCLIO:OsclDNSRequest:...request complete")); #endif }
int32 OsclSocketServI::StartServImp() { #if(PV_SOCKET_SERVER_IS_THREAD) //setup the loopback socket and/or polling interval. iLoopbackSocket.iEnable = false; iSelectPollIntervalMsec = 0; //check the select timeout in the configuration. int32 selectTimeoutMsec = PV_SOCKET_SERVER_SELECT_TIMEOUT_MSEC; if (selectTimeoutMsec <= 0) { //non-polling option selected. //create the select cancel pipe. iLoopbackSocket.Init(this); //if loopback socket isn't available, we must poll. if (!iLoopbackSocket.iEnable) iSelectPollIntervalMsec = 10; } else { //polling option selected. iSelectPollIntervalMsec = selectTimeoutMsec; #if(PV_SOCKET_SERVER_SELECT_LOOPBACK_SOCKET) //create the loopback socket. iLoopbackSocket.Init(this); #endif } //Start the server thread. OsclThread thread; OsclProcStatus::eOsclProcError err = thread.Create((TOsclThreadFuncPtr)sockthreadmain, 1024, (TOsclThreadFuncArg)this); if (err != OsclErrNone) return OsclErrGeneral; thread.SetPriority(PV_SOCKET_SERVER_THREAD_PRIORITY); //wait til thread starts iStart.Wait(); return OsclErrNone; #else//PV_SOCKET_SERVER_IS_THREAD //Socket server AO startup. iLoopbackSocket.iEnable = false; ServerEntry(); if (!IsAdded()) { AddToScheduler(); } return OsclErrNone; #endif //PV_SOCKET_SERVER_IS_THREAD }