Implements Impala::Process::Manager. Definition at line 48 of file Manager4Windows.h. References ILOG_ERROR, Impala::MakeString(), mProcesses, Impala::Process::Manager::STATE_RUNNING, Impala::Process::Manager4Windows::ProcessData::stateCode, and Impala::Process::Manager4Windows::ProcessData::winHandle. 00049 { 00050 STARTUPINFO startupInfo; 00051 ZeroMemory(&startupInfo, sizeof(startupInfo)); 00052 startupInfo.cb = sizeof(startupInfo); 00053 00054 PROCESS_INFORMATION procInfo; 00055 ZeroMemory(&procInfo, sizeof(procInfo)); 00056 00057 //std::ostrstream osAppl; 00058 //if (application != NULL) 00059 //{ 00060 // osAppl << application << std::ends; 00061 //} 00062 00063 std::ostrstream osCmdLine; 00064 osCmdLine << cmdLine << std::ends; 00065 00066 int rc = ::CreateProcess((application.empty() ? NULL : application.c_str()), osCmdLine.str(), NULL, NULL, false, CREATE_NEW_CONSOLE, NULL, NULL, &startupInfo, &procInfo); 00067 00068 osCmdLine.freeze(false); // prevents mem leak 00069 00070 if (rc == 0) 00071 { 00072 DWORD err = GetLastError(); 00073 ILOG_ERROR("Failed to create process (code " + MakeString(err) + ")"); 00074 return 0; 00075 } 00076 00077 // find free handle 00078 int handle = 0; 00079 std::map<int, ProcessData>::const_iterator iter; 00080 do 00081 { 00082 iter = mProcesses.find(++handle); 00083 } while (iter != mProcesses.end()); 00084 00085 ProcessData data; 00086 data.winHandle = procInfo.hProcess; 00087 data.stateCode = STATE_RUNNING; 00088 mProcesses[handle] = data; 00089 return handle; 00090 }
Here is the call graph for this function:
|