diff options
author | Jan-Marek Glogowski <glogow@fbihome.de> | 2017-07-27 11:42:31 +0200 |
---|---|---|
committer | Jan-Marek Glogowski <glogow@fbihome.de> | 2017-08-04 13:38:20 +0200 |
commit | d55aabfd44563027aceffd0020f55b166184a0ca (patch) | |
tree | 9073855842a11796e8ea8434896eedd7b7b10747 /vcl/source/app/svapp.cxx | |
parent | 3dd30f7ec568852ffd95932b486d0a09a2021d71 (diff) |
Implement VCL Scheduler locking
Replces the SolarMutex scheduler locking by using a distinct mutex
included in the scheduler context.
It should also get rid of the spurious assert( !bAniIdle ) failures,
as the test now holds the Scheduler lock for the whole time.
This includes reverting the additional scheduler de-init from commit
2e29a518b04250b5f9cc9d0d77da3df076834d60, as I couldn't reproduce
the bug running the unit test in valgrind.
Change-Id: If33f815fe86c8f82175e96adceb1084b925319dd
Reviewed-on: https://gerrit.libreoffice.org/40497
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
Diffstat (limited to 'vcl/source/app/svapp.cxx')
-rw-r--r-- | vcl/source/app/svapp.cxx | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index a9b7df7675c7..5d32d0532eeb 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -496,6 +496,13 @@ void Scheduler::ProcessEventsToSignal(bool& bSignal) void Scheduler::ProcessEventsToIdle() { int nSanity = 1; +#if OSL_DEBUG_LEVEL > 0 + const ImplSVData* pSVData = ImplGetSVData(); + bool bIsMainThread = pSVData->mpDefInst->IsMainThread(); + bool mbLocked = false; + if ( bIsMainThread ) + mbLocked = Scheduler::Lock(); +#endif while( Application::Reschedule( true ) ) { if (0 == ++nSanity % 1000) @@ -507,10 +514,9 @@ void Scheduler::ProcessEventsToIdle() // 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() ) + if ( !bIsMainThread ) return; - const ImplSchedulerData* pSchedulerData = ImplGetSVData()->maSchedCtx.mpFirstSchedulerData; + const ImplSchedulerData* pSchedulerData = pSVData->maSchedCtx.mpFirstSchedulerData; bool bAnyIdle = false; while ( pSchedulerData ) { @@ -520,12 +526,14 @@ void Scheduler::ProcessEventsToIdle() if ( pIdle && pIdle->IsActive() ) { bAnyIdle = true; - SAL_WARN( "vcl.schedule", "Unprocessed Idle: " << pIdle->GetDebugName() ); + SAL_WARN( "vcl.schedule", "Unprocessed Idle: " << pIdle->GetDebugName() ); } } pSchedulerData = pSchedulerData->mpNext; } assert( !bAnyIdle ); + if ( mbLocked ) + Scheduler::Unlock(); #endif } |