Request* IOProcess::addNewRequest(const char *cmd) { if( !cmd ) { return NULL; } Request* new_req = new Request(cmd); ASSERT(new_req); dprintf( D_PERF_TRACE, "request #%d (%s): dispatch\n", new_req->m_reqid, new_req->m_args.argv[0] ); // check if there is available worker process Worker *worker = findFreeWorker(); if( !worker ) { // There is no available worker if( m_max_workers == -1 || m_avail_workers_num < m_max_workers ) { worker = createNewWorker(); } } addRequestToWorker(new_req, worker); return new_req; }
Request* IOProcess::addNewRequest(const char *cmd) { if( !cmd ) { return NULL; } Request* new_req = new Request(cmd); ASSERT(new_req); // check if there is available worker process Worker *worker = findFreeWorker(); if( !worker ) { // There is no available worker if( m_max_workers == -1 || m_avail_workers_num < m_max_workers ) { worker = createNewWorker(); } } addRequestToWorker(new_req, worker); return new_req; }