From 68504d1066c26aa26b73d5be549d7a95d6afd8ed Mon Sep 17 00:00:00 2001 From: marha Date: Fri, 19 Feb 2010 17:09:40 +0000 Subject: Linux compilation is ok again. --- tools/mhmake/src/commandqueue.cpp | 69 ++++++++++++++++++++++++++++++++++----- 1 file changed, 61 insertions(+), 8 deletions(-) (limited to 'tools/mhmake/src/commandqueue.cpp') diff --git a/tools/mhmake/src/commandqueue.cpp b/tools/mhmake/src/commandqueue.cpp index 484d577a5..ae7645708 100644 --- a/tools/mhmake/src/commandqueue.cpp +++ b/tools/mhmake/src/commandqueue.cpp @@ -23,14 +23,67 @@ #include "commandqueue.h" #include "mhmakeparser.h" +#ifndef WIN32 + +#define INFINITE 0 +#define FALSE 0 + +static int Status; +unsigned WaitForMultipleObjects(int Nbr, mh_pid_t *phProcesses, int, int) +{ + mh_pid_t ID=waitpid(0,&Status,0); + for (int i=0; i pTarget=pActiveEntry->pTarget; mhmakeparser *pMakefile=pTarget->GetRule()->GetMakefile(); @@ -106,8 +159,8 @@ bool commandqueue::StartExecuteNextCommand(activeentry *pActiveEntry, HANDLE *pA if (!g_GenProjectTree) { #endif - HANDLE hProcess=pMakefile->ExecuteCommand(Command,pActiveEntry->IgnoreError); - if (hProcess==(HANDLE)-1) + mh_pid_t hProcess=pMakefile->ExecuteCommand(Command,pActiveEntry->IgnoreError); + if (hProcess==(mh_pid_t)-1) { ThrowCommandExecutionError(pActiveEntry); } @@ -235,7 +288,7 @@ mh_time_t commandqueue::WaitForTarget(const refptr &pTarget) while (1) { // First wait until one of the processes that are running is finished - DWORD Ret=WaitForMultipleObjects(m_NrActiveEntries,m_pActiveProcesses,FALSE,INFINITE); + unsigned Ret=WaitForMultipleObjects(m_NrActiveEntries,m_pActiveProcesses,FALSE,INFINITE); if (Ret>=m_NrActiveEntries) throw("fatal error: unexpected return value of WaitForMultipleObjects " + stringify(Ret)); activeentry *pActiveEntry=&m_pActiveEntries[Ret]; @@ -244,7 +297,7 @@ mh_time_t commandqueue::WaitForTarget(const refptr &pTarget) // First check the error code of the command DWORD ExitCode=0; - HANDLE hProcess=m_pActiveProcesses[Ret]; + mh_pid_t hProcess=m_pActiveProcesses[Ret]; if (!GetExitCodeProcess(hProcess,&ExitCode) || ExitCode) { if (pActiveEntry->IgnoreError) -- cgit v1.2.3