aboutsummaryrefslogtreecommitdiff
path: root/tools/mhmake/src/commandqueue.h
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2010-10-06 16:03:47 +0000
committermarha <marha@users.sourceforge.net>2010-10-06 16:03:47 +0000
commit3aef45d35bab536aaf3ad1ea040b70ea3f0612c0 (patch)
tree6775556294b8e93515bf5813f3b85dc71a463e3c /tools/mhmake/src/commandqueue.h
parentbfa0c2fa423efa7ece6e54d5f30bbe95ca4bfc2a (diff)
downloadvcxsrv-3aef45d35bab536aaf3ad1ea040b70ea3f0612c0.tar.gz
vcxsrv-3aef45d35bab536aaf3ad1ea040b70ea3f0612c0.tar.bz2
vcxsrv-3aef45d35bab536aaf3ad1ea040b70ea3f0612c0.zip
Solved reentrancy problem in commandqueue
Diffstat (limited to 'tools/mhmake/src/commandqueue.h')
-rw-r--r--tools/mhmake/src/commandqueue.h26
1 files changed, 12 insertions, 14 deletions
diff --git a/tools/mhmake/src/commandqueue.h b/tools/mhmake/src/commandqueue.h
index 3642d2f1d..d29057443 100644
--- a/tools/mhmake/src/commandqueue.h
+++ b/tools/mhmake/src/commandqueue.h
@@ -31,36 +31,34 @@ typedef pid_t mh_pid_t;
class commandqueue
{
- struct activeentry
+ struct activeentry : public refbase
{
refptr<fileinfo> pTarget;
vector<string>::const_iterator CurrentCommandIt;
string Command;
md5_context md5ctx;
bool IgnoreError;
- void clear()
- {
- pTarget=NULL;
- Command.clear();
- #ifdef _DEBUG
- md5ctx.Data.clear();
- #endif
- }
};
private:
queue< refptr<fileinfo> > m_Queue;
unsigned m_MaxNrCommandsInParallel;
mh_pid_t *m_pActiveProcesses;
- activeentry *m_pActiveEntries;
+ refptr<activeentry> *m_pActiveEntries;
unsigned m_NrActiveEntries;
+ mh_pid_t m_DummyWaitHandle;
private:
- void ThrowCommandExecutionError(activeentry *pActiveEntry);
- void AddActiveEntry(activeentry &ActiveEntry, mh_pid_t ActiveProcess);
+ void ThrowCommandExecutionError(refptr<activeentry> pActiveEntry);
+ refptr<activeentry> CreateActiveEntry(void);
+ unsigned GetActiveEntryId(const refptr<activeentry> pActiveEntry) const;
void RemoveActiveEntry(unsigned Entry);
+ void RemoveActiveEntry(refptr<activeentry> pActiveEntry)
+ {
+ RemoveActiveEntry(GetActiveEntryId(pActiveEntry));
+ }
bool StartExecuteCommands(const refptr<fileinfo> &pTarget);
- bool StartExecuteNextCommand(activeentry *pActiveEntry, mh_pid_t *pActiveProcess);
- void TargetBuildFinished(activeentry *pActiveEntry);
+ bool StartExecuteNextCommand(refptr<activeentry> pActiveEntry, mh_pid_t *pActiveProcess);
+ void TargetBuildFinished(refptr<activeentry> pActiveEntry);
public:
commandqueue();