summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan-Marek Glogowski <glogow@fbihome.de>2017-07-14 17:17:15 +0200
committerJan-Marek Glogowski <glogow@fbihome.de>2017-07-14 17:24:45 +0200
commit1c8c85e3866b1a6b35baafd3482ff7ef494a0f24 (patch)
treeb4c9022a5d7f1dc4f5852d2c8626ce3d3e65b941
parentbdbebda1d80f538f946b14042a366029f90d4820 (diff)
Fix instant 0ms scheduler wakeup for headless
This is a regression from commit 503eba23c9a199583eddee9e169a4fddbecf416f Due to rounding errors, as the Scheduler uses milliseconds, but the headless backend uses nanoseconds the StartTimer assumed it would wake up this ms, but the headless check function would still wait. This is more of a workaround, so instant wakeup for the headless backend works again. Change-Id: I2ba9b4ad2b67ec99eeb4dd098ded6457d3753127
-rw-r--r--vcl/qa/cppunit/timer.cxx4
-rw-r--r--vcl/source/app/scheduler.cxx3
2 files changed, 4 insertions, 3 deletions
diff --git a/vcl/qa/cppunit/timer.cxx b/vcl/qa/cppunit/timer.cxx
index eface298c865..c1f14ced5c38 100644
--- a/vcl/qa/cppunit/timer.cxx
+++ b/vcl/qa/cppunit/timer.cxx
@@ -413,8 +413,8 @@ void TimerTest::testTriggerIdleFromIdle()
TriggerIdleFromIdle aTest1( &bTriggered1, &aTest2 );
aTest1.Start();
Application::Yield();
- CPPUNIT_ASSERT_MESSAGE("idle triggered", bTriggered1);
- CPPUNIT_ASSERT_MESSAGE("idle triggered", bTriggered2);
+ CPPUNIT_ASSERT_MESSAGE("idle not triggered", bTriggered1);
+ CPPUNIT_ASSERT_MESSAGE("idle not triggered", bTriggered2);
}
diff --git a/vcl/source/app/scheduler.cxx b/vcl/source/app/scheduler.cxx
index a1634f73e2f3..dd2fd35b8664 100644
--- a/vcl/source/app/scheduler.cxx
+++ b/vcl/source/app/scheduler.cxx
@@ -145,7 +145,8 @@ void Scheduler::ImplStartTimer(sal_uInt64 nMS, bool bForce, sal_uInt64 nTime)
? SAL_MAX_UINT64 : rSchedCtx.mnTimerStart + rSchedCtx.mnTimerPeriod;
// Only if smaller timeout, to avoid skipping.
- if (bForce || nProposedTimeout < nCurTimeout)
+ // Force instant wakeup on 0ms, if the previous period was not 0ms
+ if (bForce || nProposedTimeout < nCurTimeout || (!nMS && rSchedCtx.mnTimerPeriod))
{
SAL_INFO( "vcl.schedule", " Starting scheduler system timer (" << nMS << "ms)" );
rSchedCtx.mnTimerStart = nTime;