forked from qt-creator/qt-creator
Introduce ProcessBlockingInterface
This replaces the ProcessInterface::waitFor...() methods. It's not obligatory to provide this interface when implementing ProcessInterface subclass. In this case generic blocking implementation will be used. The generic implementation usually isn't as efficient as the custom one, however, for some sophisticated implementations of process interface, like e.g. SshProcessInterface, providing custom implementation is really difficult and error prone. That's why we try to keep a balance: we provide two custom implementations for QProcessImpl and for ProcessLauncherImpl, as they are relatively easy to implement, and rely on generic implementation for others. Change-Id: Ifc8bd354479ec67b2e8f74f1510f8de8883e9b94 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -89,21 +89,6 @@ CallerHandle::~CallerHandle()
|
||||
qDeleteAll(m_signals);
|
||||
}
|
||||
|
||||
bool CallerHandle::waitForStarted(int msecs)
|
||||
{
|
||||
return waitForSignal(msecs, SignalType::Started);
|
||||
}
|
||||
|
||||
bool CallerHandle::waitForReadyRead(int msces)
|
||||
{
|
||||
return waitForSignal(msces, SignalType::ReadyRead);
|
||||
}
|
||||
|
||||
bool CallerHandle::waitForFinished(int msecs)
|
||||
{
|
||||
return waitForSignal(msecs, SignalType::Done);
|
||||
}
|
||||
|
||||
void CallerHandle::flush()
|
||||
{
|
||||
flushFor(SignalType::NoSignal);
|
||||
@@ -329,11 +314,11 @@ void CallerHandle::setProcessSetupData(ProcessSetupData *setup)
|
||||
m_setup = setup;
|
||||
}
|
||||
|
||||
bool CallerHandle::waitForSignal(int msecs, SignalType newSignal)
|
||||
bool CallerHandle::waitForSignal(SignalType signalType, int msecs)
|
||||
{
|
||||
QTC_ASSERT(isCalledFromCallersThread(), return false);
|
||||
QTC_ASSERT(m_launcherHandle, return false);
|
||||
return m_launcherHandle->waitForSignal(msecs, newSignal);
|
||||
return m_launcherHandle->waitForSignal(signalType, msecs);
|
||||
}
|
||||
|
||||
// Called from caller's or launcher's thread.
|
||||
@@ -351,7 +336,7 @@ bool CallerHandle::isCalledFromLaunchersThread() const
|
||||
}
|
||||
|
||||
// Called from caller's thread exclusively.
|
||||
bool LauncherHandle::waitForSignal(int msecs, CallerHandle::SignalType newSignal)
|
||||
bool LauncherHandle::waitForSignal(CallerHandle::SignalType newSignal, int msecs)
|
||||
{
|
||||
QTC_ASSERT(!isCalledFromLaunchersThread(), return false);
|
||||
QDeadlineTimer deadline(msecs);
|
||||
|
||||
Reference in New Issue
Block a user