From d10b9c9c14f7b467bef9bb9847d1f79247f8d7c2 Mon Sep 17 00:00:00 2001 From: marha Date: Mon, 22 Feb 2010 11:28:45 +0000 Subject: Solved reentrancy problem --- tools/mhmake/src/commandqueue.cpp | 34 +++++++++++++++++++++------------- tools/mhmake/src/commandqueue.h | 1 + tools/mhmake/src/util.h | 2 +- 3 files changed, 23 insertions(+), 14 deletions(-) diff --git a/tools/mhmake/src/commandqueue.cpp b/tools/mhmake/src/commandqueue.cpp index ae7645708..5c09da905 100644 --- a/tools/mhmake/src/commandqueue.cpp +++ b/tools/mhmake/src/commandqueue.cpp @@ -118,9 +118,17 @@ void commandqueue::ThrowCommandExecutionError(activeentry *pActiveEntry) throw ErrorMessage; } +void commandqueue::AddActiveEntry(activeentry &ActiveEntry, mh_pid_t ActiveProcess) +{ +//cout << "Adding entry "<GetQuotedFullFileName()<<" ("<GetQuotedFullFileName()<GetQuotedFullFileName()<<<<" ("< &pTarget) refptr pRule=pTarget->GetRule(); mhmakeparser *pMakefile=pRule->GetMakefile(); vector::iterator CommandIt=pRule->GetCommands().begin(); - activeentry *pActiveEntry=&m_pActiveEntries[m_NrActiveEntries]; - md5_starts( &pActiveEntry->md5ctx ); - pActiveEntry->pTarget=pTarget; - pActiveEntry->CurrentCommandIt=CommandIt; - pActiveEntry->pTarget=pTarget; + activeentry ActiveEntry; + mh_pid_t ActiveProcess; + + md5_starts( &ActiveEntry.md5ctx ); + + ActiveEntry.pTarget=pTarget; + ActiveEntry.CurrentCommandIt=CommandIt; while (1) { - if (StartExecuteNextCommand(pActiveEntry, &m_pActiveProcesses[m_NrActiveEntries])) + if (StartExecuteNextCommand(&ActiveEntry, &ActiveProcess)) { - pActiveEntry->CurrentCommandIt++; - if (pActiveEntry->CurrentCommandIt==pRule->GetCommands().end()) + ActiveEntry.CurrentCommandIt++; + if (ActiveEntry.CurrentCommandIt==pRule->GetCommands().end()) { // All commands executed break; @@ -248,13 +258,11 @@ bool commandqueue::StartExecuteCommands(const refptr &pTarget) } else { -//cout << "Adding entry "<pTarget->GetQuotedFullFileName()< &pTarget); bool StartExecuteNextCommand(activeentry *pActiveEntry, mh_pid_t *pActiveProcess); diff --git a/tools/mhmake/src/util.h b/tools/mhmake/src/util.h index fb61db541..9e5948448 100644 --- a/tools/mhmake/src/util.h +++ b/tools/mhmake/src/util.h @@ -50,7 +50,7 @@ #define PLATFORM "linux" #endif -#define MHMAKEVER "2.0.0" +#define MHMAKEVER "2.0.1" class makecommand { -- cgit v1.2.3