summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan-Marek Glogowski <glogow@fbihome.de>2016-09-14 15:33:54 +0200
committerJan-Marek Glogowski <glogow@fbihome.de>2017-07-13 12:10:23 +0200
commit7a1c1699a61a77d0228417da9922812c9b893b9d (patch)
tree9ded7bd1fe28e211df290090a8b49690696fcc63
parent503eba23c9a199583eddee9e169a4fddbecf416f (diff)
Run Idle tasks immediatly
There is really no reason to wait a millisecond for an idle. Change-Id: I7665d5f2e7d6ba3e01290a692bbc8e42c36b9986
-rw-r--r--include/vcl/scheduler.hxx4
-rw-r--r--solenv/gdb/libreoffice/vcl.py2
-rw-r--r--vcl/qa/cppunit/timer.cxx9
-rw-r--r--vcl/source/app/scheduler.cxx4
-rw-r--r--vcl/source/app/svapp.cxx16
5 files changed, 14 insertions, 21 deletions
diff --git a/include/vcl/scheduler.hxx b/include/vcl/scheduler.hxx
index b1c59dc0a6f5..5c5617cd0c8b 100644
--- a/include/vcl/scheduler.hxx
+++ b/include/vcl/scheduler.hxx
@@ -45,8 +45,8 @@ class VCL_DLLPUBLIC Scheduler final
static void ImplStartTimer ( sal_uInt64 nMS, bool bForce, sal_uInt64 nTime );
public:
- static constexpr sal_uInt64 ImmediateTimeoutMs = 1;
- static constexpr sal_uInt64 InfiniteTimeoutMs = 1000 * 60 * 60 * 24; // 1 day
+ static constexpr sal_uInt64 ImmediateTimeoutMs = 0;
+ static constexpr sal_uInt64 InfiniteTimeoutMs = SAL_MAX_UINT64;
static void ImplDeInitScheduler();
diff --git a/solenv/gdb/libreoffice/vcl.py b/solenv/gdb/libreoffice/vcl.py
index bcd10ae157e6..d8bac0b84331 100644
--- a/solenv/gdb/libreoffice/vcl.py
+++ b/solenv/gdb/libreoffice/vcl.py
@@ -51,7 +51,7 @@ class ImplSchedulerDataPrinter(object):
if (task_type == "Timer"):
res = "{}: {}ms".format(res, timer['mnTimeout'])
else:
- assert 1 == timer['mnTimeout'], "Idle with timeout == {}".format( timer['mnTimeout'] )
+ assert 0 == timer['mnTimeout'], "Idle with timeout == {}".format( timer['mnTimeout'] )
return res
else:
assert gdbobj['mbDelete'], "No task set and not marked for deletion!"
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