Kaydet (Commit) 52dfefec authored tarafından Jan-Marek Glogowski's avatar Jan-Marek Glogowski

Run LO scheduler only via system timer

Change-Id: I5283f18aebcd6797ad35771ae8fc4a0f425ff924
üst 272026d7
......@@ -52,8 +52,6 @@ public:
/// Process one pending Timer with highhest priority
static void CallbackTaskScheduling();
/// Are there any pending tasks to process?
static bool HasPendingTasks();
/// Process one pending task ahead of time with highest priority.
static bool ProcessTaskScheduling();
/// Process all events until we are idle
......
......@@ -327,7 +327,6 @@ struct ImplSchedulerContext
SalTimer* mpSalTimer = nullptr; ///< interface to sal event loop / system timer
sal_uInt64 mnTimerStart = 0; ///< start time of the timer
sal_uInt64 mnTimerPeriod = SAL_MAX_UINT64; ///< current timer period
bool mbNeedsReschedule = false; ///< we need to reschedule
};
struct ImplSVData
......
......@@ -57,8 +57,6 @@ void Idle::Start()
bool Idle::ReadyForSchedule( sal_uInt64 /* nTimeNow */ ) const
{
ImplSVData *pSVData = ImplGetSVData();
pSVData->maSchedCtx.mbNeedsReschedule = true;
return true;
}
......
......@@ -173,13 +173,6 @@ bool Scheduler::GetDeterministicMode()
return g_bDeterministicMode;
}
bool Scheduler::HasPendingTasks()
{
const ImplSchedulerContext &rSchedCtx = ImplGetSVData()->maSchedCtx;
return ( rSchedCtx.mbNeedsReschedule || ((rSchedCtx.mnTimerPeriod != InfiniteTimeoutMs)
&& (tools::Time::GetSystemTicks() >= rSchedCtx.mnTimerStart + rSchedCtx.mnTimerPeriod )) );
}
inline void Scheduler::UpdateMinPeriod( ImplSchedulerData * const pSchedulerData,
const sal_uInt64 nTime, sal_uInt64 &nMinPeriod )
{
......@@ -247,7 +240,6 @@ bool Scheduler::ProcessTaskScheduling()
sal_uInt64 nTime = tools::Time::GetSystemTicks();
if ( pSVData->mbDeInit || InfiniteTimeoutMs == rSchedCtx.mnTimerPeriod )
return false;
rSchedCtx.mbNeedsReschedule = false;
if ( nTime < rSchedCtx.mnTimerStart + rSchedCtx.mnTimerPeriod )
{
......@@ -420,7 +412,6 @@ void Task::Start()
mpSchedulerData->mbDelete = false;
mpSchedulerData->mnUpdateTime = tools::Time::GetSystemTicks();
rSchedCtx.mbNeedsReschedule = true;
}
void Task::Stop()
......
......@@ -470,10 +470,6 @@ inline bool ImplYield(bool i_bWait, bool i_bAllEvents, sal_uLong const nReleased
SAL_INFO("vcl.schedule", "Enter ImplYield: " << (i_bWait ? "wait" : "no wait") <<
": " << (i_bAllEvents ? "all events" : "one event") << ": " << nReleased);
// we handle pending task outside the system event loop, so don't wait
if (i_bWait && Scheduler::HasPendingTasks())
i_bWait = false;
// TODO: there's a data race here on WNT only because ImplYield may be
// called without SolarMutex; if we can get rid of LazyDelete (with VclPtr)
// then the only remaining use of mnDispatchLevel is in OSX specific code
......@@ -487,24 +483,16 @@ inline bool ImplYield(bool i_bWait, bool i_bAllEvents, sal_uLong const nReleased
i_bWait && !pSVData->maAppData.mbAppQuit,
i_bAllEvents, nReleased);
SAL_INFO("vcl.schedule", "DoYield returns: " << bProcessedEvent );
pSVData->maAppData.mnDispatchLevel--;
DBG_TESTSOLARMUTEX(); // must be locked on return from Yield
if (nReleased == 0) // tdf#99383 don't run stuff from ReAcquireSolarMutex
{
// Process all Tasks
bProcessedEvent = Scheduler::ProcessTaskScheduling() || bProcessedEvent;
}
// flush lazy deleted objects
if( pSVData->maAppData.mnDispatchLevel == 0 )
vcl::LazyDelete::flush();
SAL_INFO("vcl.schedule", "Leave ImplYield with return " << bProcessedEvent );
return bProcessedEvent || Scheduler::HasPendingTasks();
return bProcessedEvent;
}
bool Application::Reschedule( bool i_bAllEvents )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment