Run Idle tasks immediatly
There is really no reason to wait a millisecond for an idle. Change-Id: I7665d5f2e7d6ba3e01290a692bbc8e42c36b9986
This commit is contained in:
parent
503eba23c9
commit
7a1c1699a6
@ -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();
|
||||
|
||||
|
@ -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!"
|
||||
|
@ -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 );
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user