diff options
author | Jan-Marek Glogowski <glogow@fbihome.de> | 2020-12-16 10:51:33 +0100 |
---|---|---|
committer | Jan-Marek Glogowski <glogow@fbihome.de> | 2020-12-16 23:03:23 +0100 |
commit | 8b092e2e10b7864966a77dd1225acc1f43a12ee4 (patch) | |
tree | d3ac1436b978672c07c49a48fc25b396dc869aca /vcl | |
parent | c6a7cc15e971218c2488fc2bba8016937264e2e0 (diff) |
Scheduler assert mbInScheduler state
Since the introduction of the scheduler stack, this became merely
a debugging and assertion hint. So actually handle it like that
and don't use it for any decisions, even in debug code.
Change-Id: Ibeb247279d9e94ea4ff3a7b4652e98e179d6c76e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107824
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/schedulerimpl.hxx | 12 | ||||
-rw-r--r-- | vcl/source/app/scheduler.cxx | 3 | ||||
-rw-r--r-- | vcl/source/app/svapp.cxx | 3 |
3 files changed, 17 insertions, 1 deletions
diff --git a/vcl/inc/schedulerimpl.hxx b/vcl/inc/schedulerimpl.hxx index f6d5dda708bd..56563ded4cc9 100644 --- a/vcl/inc/schedulerimpl.hxx +++ b/vcl/inc/schedulerimpl.hxx @@ -32,6 +32,18 @@ struct ImplSchedulerData final Task* mpTask; ///< Pointer to VCL Task instance sal_uInt64 mnUpdateTime; ///< Last Update Time TaskPriority mePriority; ///< Task priority + /** + * Is the Task currently processed / on the stack? + * + * Since the introduction of the scheduler stack, this became merely a + * debugging and assertion hint. No decisions are anymore made based on + * this, because invoked Tasks are removed from the scheduler lists and + * placed on the stack, so no code should actually ever find one, where + * mbInScheduler is true (I don't see a reason to walk the stack for + * normal Scheduler usage, that is). + * + * This was originally used to prevent invoking Tasks recursively. + **/ bool mbInScheduler; ///< Task currently processed? const char *GetDebugName() const; diff --git a/vcl/source/app/scheduler.cxx b/vcl/source/app/scheduler.cxx index da8511bffa55..b325f9238a7d 100644 --- a/vcl/source/app/scheduler.cxx +++ b/vcl/source/app/scheduler.cxx @@ -442,6 +442,7 @@ bool Scheduler::ProcessTaskScheduling() // prepare Scheduler object for deletion after handling pTask->SetDeletionFlags(); + assert(!pMostUrgent->mbInScheduler); pMostUrgent->mbInScheduler = true; // always push the stack, as we don't traverse the whole list to push later @@ -479,6 +480,8 @@ bool Scheduler::ProcessTaskScheduling() std::abort(); } Lock(); + + assert(pMostUrgent->mbInScheduler); pMostUrgent->mbInScheduler = false; SAL_INFO( "vcl.schedule", tools::Time::GetSystemTicks() << " " diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index 340d7b91d4fe..c1cbd6d093ce 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -479,7 +479,8 @@ void Scheduler::ProcessEventsToIdle() const ImplSchedulerData* pSchedulerData = pSVData->maSchedCtx.mpFirstSchedulerData[nTaskPriority]; while (pSchedulerData) { - if (pSchedulerData->mpTask && !pSchedulerData->mbInScheduler) + assert(!pSchedulerData->mbInScheduler); + if (pSchedulerData->mpTask) { Idle *pIdle = dynamic_cast<Idle*>(pSchedulerData->mpTask); if (pIdle && pIdle->IsActive()) |