[Libreoffice-commits] core.git: Branch 'feature/fixes19' - include/vcl vcl/source

Michael Meeks michael.meeks at collabora.com
Thu Mar 24 13:48:30 UTC 2016


 include/vcl/scheduler.hxx    |    3 ++-
 vcl/source/app/scheduler.cxx |    6 ++++--
 vcl/source/app/svapp.cxx     |    6 +++---
 3 files changed, 9 insertions(+), 6 deletions(-)

New commits:
commit 85e2390e880094d1c7d58a370a5dcbee1d47b847
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Thu Mar 24 13:45:43 2016 +0000

    vcl: improve timing determinism by avoiding low prio. idles.
    
    Change-Id: I7d47cddc239cfab98339648eca7596aa1f1a11a9

diff --git a/include/vcl/scheduler.hxx b/include/vcl/scheduler.hxx
index 95303ee..a5f4059 100644
--- a/include/vcl/scheduler.hxx
+++ b/include/vcl/scheduler.hxx
@@ -93,7 +93,8 @@ public:
     // Process one pending Timer with highhest priority
     static void CallbackTaskScheduling( bool ignore );
     /// Calculate minimum timeout - and return its value.
-    static sal_uInt64 CalculateMinimumTimeout( bool &bHasActiveIdles );
+    static sal_uInt64 CalculateMinimumTimeout( bool &bHasActiveIdles,
+                                               bool  bIgnoreLowPriority = false );
     /// Process one pending task ahead of time with highest priority.
     static bool       ProcessTaskScheduling( bool bTimerOnly );
     /// Process all events until we are idle
diff --git a/vcl/source/app/scheduler.cxx b/vcl/source/app/scheduler.cxx
index 879ca42..cb4a911 100644
--- a/vcl/source/app/scheduler.cxx
+++ b/vcl/source/app/scheduler.cxx
@@ -174,7 +174,8 @@ bool Scheduler::ProcessTaskScheduling( bool bTimerOnly )
         return false;
 }
 
-sal_uInt64 Scheduler::CalculateMinimumTimeout( bool &bHasActiveIdles )
+sal_uInt64 Scheduler::CalculateMinimumTimeout( bool &bHasActiveIdles,
+                                               bool  bIgnoreLowPriority )
 {
     // process all pending Tasks
     // if bTimer True, only handle timer
@@ -203,7 +204,8 @@ sal_uInt64 Scheduler::CalculateMinimumTimeout( bool &bHasActiveIdles )
             pNext = pSchedulerData->mpNext;
             delete pSchedulerData;
         }
-        else
+        else if (!bIgnoreLowPriority ||
+                 pSchedulerData->mpScheduler->mePriority >= SchedulerPriority::DEFAULT_IDLE)
         {
             if (!pSchedulerData->mbInScheduler)
             {
diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx
index a18b91e..c9c2101 100644
--- a/vcl/source/app/svapp.cxx
+++ b/vcl/source/app/svapp.cxx
@@ -473,7 +473,7 @@ void Application::Execute()
     pSVData->maAppData.mbInAppExecute = false;
 }
 
-inline bool ImplYield(bool i_bWait, bool i_bAllEvents, sal_uLong const nReleased)
+inline bool ImplYield(bool i_bWait, bool i_bAllEvents, sal_uLong const nReleased, bool bIgnoreLowPrio = false)
 {
     ImplSVData* pSVData = ImplGetSVData();
 
@@ -483,7 +483,7 @@ inline bool ImplYield(bool i_bWait, bool i_bAllEvents, sal_uLong const nReleased
     bool bHasActiveIdles = false;
     sal_uInt64 nMinTimeout = 0;
     if (nReleased == 0) // else thread doesn't have SolarMutex so avoid race
-        nMinTimeout = Scheduler::CalculateMinimumTimeout(bHasActiveIdles);
+        nMinTimeout = Scheduler::CalculateMinimumTimeout(bHasActiveIdles, bIgnoreLowPrio);
 
     // FIXME: should use returned value as param to DoYield
     (void)nMinTimeout;
@@ -535,7 +535,7 @@ void Application::Reschedule( bool i_bAllEvents )
 void Scheduler::ProcessEventsToIdle()
 {
     int nSanity = 100;
-    while(ImplYield(false, true, 0))
+    while(ImplYield(false, true, 0, true))
     {
         if (nSanity-- < 0)
         {


More information about the Libreoffice-commits mailing list