diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2020-04-08 15:10:45 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2020-04-08 23:11:45 +0200 |
commit | 486d32f1e83002e6ff43db32463fb49393cc3664 (patch) | |
tree | 042eff42aec95b82c21321be13010c6fd4c5e102 /vcl/headless | |
parent | 5186dd92779d1fc2032415f59979cd6afd6b426c (diff) |
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@collabora.com>
Diffstat (limited to 'vcl/headless')
-rw-r--r-- | vcl/headless/svpinst.cxx | 16 |
1 files changed, 11 insertions, 5 deletions
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 ) |