diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2017-08-29 08:58:34 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2017-08-29 08:58:34 +0200 |
commit | 5bcf4e98769dbaf07e8b28a86edc2d3d648a571c (patch) | |
tree | 9baf2a3e7982879433daf2fd3752052a76b765ba | |
parent | loplugin:cstylecast/nullptr (clang-cl) (diff) | |
download | core-5bcf4e98769dbaf07e8b28a86edc2d3d648a571c.tar.gz core-5bcf4e98769dbaf07e8b28a86edc2d3d648a571c.zip |
Avoid deadlock under --enable-debug
...as seen during JunitTest_sc_unoapi_2 in an --enable-dbgutil build, where
thread 1 owns the SolarMutex and tries to acquire the scheduler mutex while
thread 7 owns the scheduler mutex and tries to re-acquire the SolarMutex. Keep
the SAL_WARN output about unprocessed idles just in case somebody considers it
useful (but it needs to be taken with a grain of salt, of course).
Change-Id: Ib83d02876dc0d3b3b9a4c08581edf9c378fc911b
-rw-r--r-- | vcl/source/app/svapp.cxx | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index 5a5be865906f..fdbc5f9d9522 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -496,12 +496,6 @@ 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(); - if ( bIsMainThread ) - Scheduler::Lock(); -#endif while( Application::Reschedule( true ) ) { if (0 == ++nSanity % 1000) @@ -513,10 +507,10 @@ 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. - if ( !bIsMainThread ) + const ImplSVData* pSVData = ImplGetSVData(); + if ( !pSVData->mpDefInst->IsMainThread() ) return; const ImplSchedulerData* pSchedulerData = pSVData->maSchedCtx.mpFirstSchedulerData; - bool bAnyIdle = false; while ( pSchedulerData ) { if ( pSchedulerData->mpTask && !pSchedulerData->mbInScheduler ) @@ -524,14 +518,11 @@ void Scheduler::ProcessEventsToIdle() 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 ); - Scheduler::Unlock(); #endif } |