diff options
author | marha <marha@users.sourceforge.net> | 2010-02-22 11:28:45 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2010-02-22 11:28:45 +0000 |
commit | d10b9c9c14f7b467bef9bb9847d1f79247f8d7c2 (patch) | |
tree | f7e995c9afdec8a4c90fdba138b2dfc34e7966f5 /tools | |
parent | 38eb5d4eed017f0c460761830f622d4cdb18da15 (diff) | |
download | vcxsrv-d10b9c9c14f7b467bef9bb9847d1f79247f8d7c2.tar.gz vcxsrv-d10b9c9c14f7b467bef9bb9847d1f79247f8d7c2.tar.bz2 vcxsrv-d10b9c9c14f7b467bef9bb9847d1f79247f8d7c2.zip |
Solved reentrancy problem
Diffstat (limited to 'tools')
-rw-r--r-- | tools/mhmake/src/commandqueue.cpp | 34 | ||||
-rw-r--r-- | tools/mhmake/src/commandqueue.h | 1 | ||||
-rw-r--r-- | 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 "<<m_NrActiveEntries<<" to queue:"<<ActiveEntry.pTarget->GetQuotedFullFileName()<<" ("<<ActiveProcess<<")\n";
+ m_pActiveEntries[m_NrActiveEntries]=ActiveEntry;
+ m_pActiveProcesses[m_NrActiveEntries]=ActiveProcess;
+ m_NrActiveEntries++;
+}
+
void commandqueue::RemoveActiveEntry(unsigned Entry)
{
-//cout << "Remove entry "<<Entry<<" of "<<m_NrActiveEntries<<" from queue:"<<m_pActiveEntries[Entry].pTarget->GetQuotedFullFileName()<<endl;
+//cout << "Remove entry "<<Entry<<" of "<<m_NrActiveEntries<<" from queue:"<<m_pActiveEntries[Entry].pTarget->GetQuotedFullFileName()<<<<" ("<<m_pActiveEntries[Entry]<<")\n";
unsigned NrToMove=m_NrActiveEntries-Entry-1;
if (NrToMove)
{
@@ -228,19 +236,21 @@ bool commandqueue::StartExecuteCommands(const refptr<fileinfo> &pTarget) refptr<rule> pRule=pTarget->GetRule();
mhmakeparser *pMakefile=pRule->GetMakefile();
vector<string>::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<fileinfo> &pTarget) }
else
{
-//cout << "Adding entry "<<m_NrActiveEntries<<" to queue:"<<pActiveEntry->pTarget->GetQuotedFullFileName()<<endl;
- m_NrActiveEntries++;
+ AddActiveEntry(ActiveEntry,ActiveProcess);
return false;
}
}
- TargetBuildFinished(pActiveEntry);
- *pActiveEntry=activeentry();
+ TargetBuildFinished(&ActiveEntry);
return true;
}
diff --git a/tools/mhmake/src/commandqueue.h b/tools/mhmake/src/commandqueue.h index 7480d63dd..84878067e 100644 --- a/tools/mhmake/src/commandqueue.h +++ b/tools/mhmake/src/commandqueue.h @@ -48,6 +48,7 @@ private: private:
void ThrowCommandExecutionError(activeentry *pActiveEntry);
+ void AddActiveEntry(activeentry &ActiveEntry, mh_pid_t ActiveProcess);
void RemoveActiveEntry(unsigned Entry);
bool StartExecuteCommands(const refptr<fileinfo> &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
{
|