[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - vcl/headless

Michael Meeks (via logerrit) logerrit at kemper.freedesktop.org
Wed Apr 8 21:11:10 UTC 2020


 vcl/headless/svpinst.cxx |   16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

New commits:
commit 366bd3599cc64ea8474cb72df51540774a6021eb
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:10:40 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/+/91927
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>

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 )


More information about the Libreoffice-commits mailing list