summaryrefslogtreecommitdiff
path: root/vcl/source/app/svapp.cxx
diff options
context:
space:
mode:
authorJan-Marek Glogowski <glogow@fbihome.de>2017-01-23 11:56:41 +0100
committerJan-Marek Glogowski <glogow@fbihome.de>2017-07-13 12:10:20 +0200
commitc0710abfebd320903a3edb23d4b1441ea351b0be (patch)
treed0a02eceed8c830cfc7a1da2bc7d14d70c8a69aa /vcl/source/app/svapp.cxx
parentdc63cc326ee5757124cef45e470d290e6e32002e (diff)
Add some Scheduler unit tests and logging
1. calling Start() for invoked tasks 2. correctly schedule by priority 3. self-stopping AutoTimer This also adds SAL_INFO output to Scheduler and Task to log the scheduling processing tasks. Change-Id: I3c8a708d1fd51c550320f8af3f9486c43c32e358
Diffstat (limited to 'vcl/source/app/svapp.cxx')
-rw-r--r--vcl/source/app/svapp.cxx28
1 files changed, 26 insertions, 2 deletions
diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx
index c4d22d397013..fff8619d51fc 100644
--- a/vcl/source/app/svapp.cxx
+++ b/vcl/source/app/svapp.cxx
@@ -516,9 +516,9 @@ inline bool ImplYield(bool i_bWait, bool i_bAllEvents, sal_uLong const nReleased
return bHasActiveIdles || eResult == SalYieldResult::EVENT;
}
-void Application::Reschedule( bool i_bAllEvents )
+bool Application::Reschedule( bool i_bAllEvents )
{
- ImplYield(false, i_bAllEvents, 0);
+ return ImplYield(false, i_bAllEvents, 0);
}
void Scheduler::ProcessEventsToSignal(bool& bSignal)
@@ -541,6 +541,30 @@ void Scheduler::ProcessEventsToIdle()
break;
}
}
+#if OSL_DEBUG_LEVEL > 0
+ // If we yield from a non-main thread we just can guarantee that all idle
+ // events were processed at some point, but our check can't prevent further
+ // processing in the main thread, which may add new events, so skip it.
+ const ImplSVData* pSVData = ImplGetSVData();
+ if ( !pSVData->mpDefInst->IsMainThread() )
+ return;
+ const ImplSchedulerData* pSchedulerData = ImplGetSVData()->mpFirstSchedulerData;
+ bool bAnyIdle = false;
+ while ( pSchedulerData )
+ {
+ if ( pSchedulerData->mpTask && !pSchedulerData->mbInScheduler )
+ {
+ Idle *pIdle = dynamic_cast<Idle*>( pSchedulerData->mpTask );
+ if ( pIdle && pIdle->IsActive() )
+ {
+ bAnyIdle = true;
+ SAL_WARN( "vcl.schedule", "Unprocessed Idle: " << pIdle->GetDebugName() );
+ }
+ }
+ pSchedulerData = pSchedulerData->mpNext;
+ }
+ assert( !bAnyIdle );
+#endif
}
extern "C" {