summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2020-04-08 15:10:45 +0100
committerMichael Meeks <michael.meeks@collabora.com>2020-04-08 23:10:40 +0200
commit366bd3599cc64ea8474cb72df51540774a6021eb (patch)
tree45431a428a91bf5cbc852d08a53fc64f16432820
parent1eaae412c596585a2ff37fb618341930ea091f05 (diff)
tdf#131985 - ensure the Kit poll callback gets into fast idle loops.distro/collabora/cp-6.2
Comparing with the windows impl. it seems that it is possible to get timeout / idle starvation, and we need to poll and be responsive on our sockets even in this this case. As such, ensure we end up in the Kit poll callback, even when we have very short timeouts / busy-idle loops. Change-Id: I4bcac46af931de52a675f66fd189cd0ee14a0859 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91927 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Ashod Nakashian <ashnakash@gmail.com> Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
-rw-r--r--vcl/headless/svpinst.cxx16
1 files changed, 11 insertions, 5 deletions
diff --git a/vcl/headless/svpinst.cxx b/vcl/headless/svpinst.cxx
index 0247474c60a4..9aa0e134dcc8 100644
--- a/vcl/headless/svpinst.cxx
+++ b/vcl/headless/svpinst.cxx
@@ -422,13 +422,20 @@ bool SvpSalInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents)
if (!bHandleAllCurrentEvents && bEvent)
return true;
- bEvent = CheckTimeout() || bEvent;
+ ImplSVData* pSVData = ImplGetSVData();
+
+ bool bTimeout = CheckTimeout();
+ bool bSkipPoll = bEvent;
+ if (pSVData->mpPollCallback == nullptr)
+ bSkipPoll = bEvent || bTimeout;
+ // else - give the poll-callback visibility into waiting timeouts too.
SvpSalYieldMutex *const pMutex(static_cast<SvpSalYieldMutex*>(GetYieldMutex()));
if (IsMainThread())
{
- if (bWait && ! bEvent)
+ // in kit case
+ if (bWait && !bSkipPoll)
{
sal_Int64 nTimeoutMicroS = 0;
if (m_aTimeout.tv_sec) // Timer is started.
@@ -443,7 +450,6 @@ bool SvpSalInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents)
else
nTimeoutMicroS = -1; // wait until something happens
- ImplSVData* pSVData = ImplGetSVData();
sal_uInt32 nAcquireCount = ReleaseYieldMutexAll();
if (pSVData->mpPollCallback)
@@ -479,7 +485,7 @@ bool SvpSalInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents)
}
AcquireYieldMutex( nAcquireCount );
}
- else if (bEvent)
+ else if (bSkipPoll)
{
pMutex->m_NonMainWaitingYieldCond.set(); // wake up other threads
}
@@ -504,7 +510,7 @@ bool SvpSalInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents)
}
}
- return bEvent;
+ return bSkipPoll;
}
bool SvpSalInstance::AnyInput( VclInputFlags nType )