VirtualBox

Changeset 26397 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Feb 9, 2010 6:44:52 PM (15 years ago)
Author:
vboxsync
Message:

Web service: error handling, consistency

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/webservice/vboxweb.cpp

    r26396 r26397  
    102102unsigned int            g_uBindToPort = 18083;          // port
    103103unsigned int            g_uBacklog = 100;               // backlog = max queue size for requests
     104unsigned int            g_cWorkerThreads = 10;          // no. of worker threads
    104105
    105106bool                    g_fVerbose = false;             // be verbose
     
    283284            pst->pQ = this;
    284285            pst->soap = soap_copy(pSoap);
    285             RTThreadCreate(&pst->pThread,
    286                            fntSoapQueue,
    287                            pst,             // pvUser
    288                            0,               // cbStack,
    289                            RTTHREADTYPE_MAIN_HEAVY_WORKER,
    290                            0,
    291                            "SoapQWorker");
     286            if (!RT_SUCCESS(RTThreadCreate(&pst->pThread,
     287                                           fntSoapQueue,
     288                                           pst,             // pvUser
     289                                           0,               // cbStack,
     290                                           RTTHREADTYPE_MAIN_HEAVY_WORKER,
     291                                           0,
     292                                           "SoapQWorker")))
     293            {
     294                RTStrmPrintf(g_pStdErr, "[!] Cannot start worker thread %d\n", pst->u);
     295                exit(1);
     296            }
     297
    292298            m_llAllThreads.push_back(pst);
    293299            ++m_cIdleThreads;
     
    397403        pst->soap->socket = pst->pQ->get();
    398404
    399         WebLog("T%d handles connection from IP=%lu.%lu.%lu.%lu socket=%d (%d thr idle)\n",
     405        WebLog("T%d handles connection from IP=%lu.%lu.%lu.%lu socket=%d (%d threads idle)\n",
    400406                pst->u,
    401407                (pst->soap->ip>>24)&0xFF,
     
    424430 * worker threads.
    425431 */
    426 void beginProcessing(size_t cThreads)
     432void beginProcessing()
    427433{
    428434    // set up gSOAP
     
    448454
    449455        // initialize thread queue, mutex and eventsem, create worker threads
    450         SoapQ soapq(cThreads, &soap);
     456        SoapQ soapq(g_cWorkerThreads, &soap);
    451457
    452458        for (uint64_t i = 1;
     
    487493{
    488494    int rc;
    489 
    490     uint32_t cWorkerThreads = 5;
    491495
    492496    // intialize runtime
     
    536540
    537541            case 'T':
    538                 cWorkerThreads = ValueUnion.u32;
     542                g_cWorkerThreads = ValueUnion.u32;
    539543            break;
    540544
     
    643647    }
    644648
    645     beginProcessing(cWorkerThreads);
     649    beginProcessing();
    646650
    647651    com::Shutdown();
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette