[Libreoffice-commits] core.git: vcl/headless
Michael Meeks (via logerrit)
logerrit at kemper.freedesktop.org
Wed Apr 8 21:12:18 UTC 2020
vcl/headless/svpinst.cxx | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
New commits:
commit 486d32f1e83002e6ff43db32463fb49393cc3664
Author: Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Wed Apr 8 15:10:45 2020 +0100
Commit: Michael Meeks <michael.meeks at collabora.com>
CommitDate: Wed Apr 8 23:11:45 2020 +0200
tdf#131985 - ensure the Kit poll callback gets into fast idle loops.
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/+/91893
Tested-by: Jenkins
Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
diff --git a/vcl/headless/svpinst.cxx b/vcl/headless/svpinst.cxx
index 9501bd6af053..daaa4d170b3e 100644
--- a/vcl/headless/svpinst.cxx
+++ b/vcl/headless/svpinst.cxx
@@ -439,13 +439,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.
@@ -460,7 +467,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)
@@ -496,7 +502,7 @@ bool SvpSalInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents)
}
AcquireYieldMutex( nAcquireCount );
}
- else if (bEvent)
+ else if (bSkipPoll)
{
pMutex->m_NonMainWaitingYieldCond.set(); // wake up other threads
}
@@ -521,7 +527,7 @@ bool SvpSalInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents)
}
}
- return bEvent;
+ return bSkipPoll;
}
bool SvpSalInstance::AnyInput( VclInputFlags nType )
More information about the Libreoffice-commits
mailing list