diff options
author | Jan-Marek Glogowski <glogow@fbihome.de> | 2016-09-14 15:33:54 +0200 |
---|---|---|
committer | Jan-Marek Glogowski <glogow@fbihome.de> | 2017-07-13 12:10:23 +0200 |
commit | 7a1c1699a61a77d0228417da9922812c9b893b9d (patch) | |
tree | 9ded7bd1fe28e211df290090a8b49690696fcc63 /vcl | |
parent | 503eba23c9a199583eddee9e169a4fddbecf416f (diff) |
Run Idle tasks immediatly
There is really no reason to wait a millisecond for an idle.
Change-Id: I7665d5f2e7d6ba3e01290a692bbc8e42c36b9986
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/qa/cppunit/timer.cxx | 9 | ||||
-rw-r--r-- | vcl/source/app/scheduler.cxx | 4 | ||||
-rw-r--r-- | vcl/source/app/svapp.cxx | 16 |
3 files changed, 11 insertions, 18 deletions
diff --git a/vcl/qa/cppunit/timer.cxx b/vcl/qa/cppunit/timer.cxx index dcd11319e293..eface298c865 100644 --- a/vcl/qa/cppunit/timer.cxx +++ b/vcl/qa/cppunit/timer.cxx @@ -19,6 +19,7 @@ #include <vcl/timer.hxx> #include <vcl/idle.hxx> #include <vcl/svapp.hxx> +#include <vcl/scheduler.hxx> #include "svdata.hxx" #include "salinst.hxx" @@ -125,7 +126,7 @@ void TimerTest::testIdle() { bool bTriggered = false; IdleBool aTest( bTriggered ); - while ( Application::Reschedule() ); + Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT_MESSAGE("idle triggered", bTriggered); } @@ -438,7 +439,7 @@ void TimerTest::testInvokedReStart() { sal_Int32 nCount = 0; IdleInvokedReStart aIdle( nCount ); - while ( Application::Reschedule() ); + Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT_EQUAL( nCount, sal_Int32(2) ); } @@ -473,7 +474,7 @@ void TimerTest::testPriority() aLowPrioIdle.SetPriority( TaskPriority::LOWEST ); IdleSerializer aHighPrioIdle( "IdleSerializer HighPrio", 1, nProcessed ); aHighPrioIdle.SetPriority( TaskPriority::HIGHEST ); - while ( Application::Reschedule() ); + Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT_EQUAL_MESSAGE( "Not all idles processed", sal_uInt32(2), nProcessed ); } @@ -484,7 +485,7 @@ void TimerTest::testPriority() aHighPrioIdle.SetPriority( TaskPriority::HIGHEST ); IdleSerializer aLowPrioIdle( "IdleSerializer LowPrio", 2, nProcessed ); aLowPrioIdle.SetPriority( TaskPriority::LOWEST ); - while ( Application::Reschedule() ); + Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT_EQUAL_MESSAGE( "Not all idles processed", sal_uInt32(2), nProcessed ); } } diff --git a/vcl/source/app/scheduler.cxx b/vcl/source/app/scheduler.cxx index c2e9bccff116..3ad49f5844c2 100644 --- a/vcl/source/app/scheduler.cxx +++ b/vcl/source/app/scheduler.cxx @@ -139,10 +139,6 @@ void Scheduler::ImplStartTimer(sal_uInt64 nMS, bool bForce, sal_uInt64 nTime) rSchedCtx.mpSalTimer->SetCallback(Scheduler::CallbackTaskScheduling); } - if ( nMS > InfiniteTimeoutMs ) - nMS = InfiniteTimeoutMs; - if ( nMS < ImmediateTimeoutMs ) - nMS = ImmediateTimeoutMs; assert(SAL_MAX_UINT64 - nMS >= nTime); sal_uInt64 nProposedTimeout = nTime + nMS; diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index a6cad056c27a..82dc621b4ccc 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -54,6 +54,7 @@ #if HAVE_FEATURE_OPENGL #include <vcl/opengl/OpenGLWrapper.hxx> #endif +#include <saltimer.hxx> #include "salinst.hxx" #include "salframe.hxx" @@ -513,22 +514,17 @@ bool Application::Reschedule( bool i_bAllEvents ) void Scheduler::ProcessEventsToSignal(bool& bSignal) { - while(!bSignal && (Scheduler::ProcessTaskScheduling() || - ImplYield(false, false, 0))) - { - } + while (!bSignal && Application::Reschedule( false ) ); } void Scheduler::ProcessEventsToIdle() { - int nSanity = 1000; - while( Scheduler::ProcessTaskScheduling() || - ImplYield(false, true, 0) ) + int nSanity = 1; + while( Application::Reschedule( true ) ) { - if (nSanity-- < 0) + if (0 == ++nSanity % 1000) { - SAL_WARN("vcl.schedule", "Unexpected volume of events to process"); - break; + SAL_WARN("vcl.schedule", "ProcessEventsToIdle: " << nSanity); } } #if OSL_DEBUG_LEVEL > 0 |