diff options
author | hjk <hjk@qt.io> | 2021-11-26 18:40:56 +0100 |
---|---|---|
committer | hjk <hjk@qt.io> | 2021-12-06 09:26:19 +0000 |
commit | 64ac719ff8c82cbd0da0a363140d4be79f9785e4 (patch) | |
tree | bd8a00093f8b2a956f7f41c5b7798b27c59134b0 /src/libs/utils/processreaper.cpp | |
parent | ce82c058dff7021e58b09b67ea406a2fac25594d (diff) |
Utils: Slim down private ProcessReaper interface
Change-Id: Idd5669b9ed525148426b85bbbc9a2818877f2707
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Diffstat (limited to 'src/libs/utils/processreaper.cpp')
-rw-r--r-- | src/libs/utils/processreaper.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/libs/utils/processreaper.cpp b/src/libs/utils/processreaper.cpp index cbdf29abe72..076981573d3 100644 --- a/src/libs/utils/processreaper.cpp +++ b/src/libs/utils/processreaper.cpp @@ -60,9 +60,11 @@ private: QProcess::ProcessState m_lastState = QProcess::NotRunning; }; +static QList<Reaper *> g_reapers; + Reaper::Reaper(QProcess *p, int timeoutMs) : m_process(p) { - ProcessReaper::instance()->m_reapers.append(this); + g_reapers.append(this); m_iterationTimer.setInterval(timeoutMs); m_iterationTimer.setSingleShot(true); @@ -73,7 +75,7 @@ Reaper::Reaper(QProcess *p, int timeoutMs) : m_process(p) Reaper::~Reaper() { - ProcessReaper::instance()->m_reapers.removeOne(this); + g_reapers.removeOne(this); } int Reaper::timeoutMs() const @@ -144,12 +146,12 @@ void Reaper::nextIteration() ProcessReaper::~ProcessReaper() { - while (!m_reapers.isEmpty()) { + while (!Internal::g_reapers.isEmpty()) { int alreadyWaited = 0; QList<Internal::Reaper *> toDelete; // push reapers along: - for (Internal::Reaper *pr : qAsConst(m_reapers)) { + for (Internal::Reaper *pr : qAsConst(Internal::g_reapers)) { const int timeoutMs = pr->timeoutMs(); if (alreadyWaited < timeoutMs) { const unsigned long toSleep = static_cast<unsigned long>(timeoutMs - alreadyWaited); |