Kaydet (Commit) 11403bc1 authored tarafından Jan-Marek Glogowski's avatar Jan-Marek Glogowski

Abort on critical Scheduler problems

We don't have the possibility to continue processing tasks without
the scheduler lock. Same situation, if a task throws an exception.
In both cases we just abort() instead of using assertions.

Change-Id: I4d52a6ef0526a1e46b64f9f3a6e0cc1a718618cc
üst cb8bfa9a
...@@ -124,20 +124,23 @@ void Scheduler::ImplDeInitScheduler() ...@@ -124,20 +124,23 @@ void Scheduler::ImplDeInitScheduler()
void SchedulerMutex::acquire( sal_uInt32 nLockCount ) void SchedulerMutex::acquire( sal_uInt32 nLockCount )
{ {
assert(nLockCount > 0);
for (sal_uInt32 i = 0; i != nLockCount; ++i) { for (sal_uInt32 i = 0; i != nLockCount; ++i) {
bool ok = maMutex.acquire(); if (!maMutex.acquire())
assert(ok); (void) ok; abort();
++mnLockDepth;
} }
mnLockDepth += nLockCount;
} }
sal_uInt32 SchedulerMutex::release( bool bUnlockAll ) sal_uInt32 SchedulerMutex::release( bool bUnlockAll )
{ {
assert(mnLockDepth != 0); assert(mnLockDepth > 0);
sal_uInt32 nLockCount = bUnlockAll ? mnLockDepth : 1; const sal_uInt32 nLockCount =
(bUnlockAll || 0 == mnLockDepth) ? mnLockDepth : 1;
mnLockDepth -= nLockCount; mnLockDepth -= nLockCount;
for (sal_uInt32 i = 0; i != nLockCount; ++i) { for (sal_uInt32 i = 0; i != nLockCount; ++i) {
maMutex.release(); if (!maMutex.release())
abort();
} }
return nLockCount; return nLockCount;
} }
...@@ -373,7 +376,16 @@ next_entry: ...@@ -373,7 +376,16 @@ next_entry:
// not run a nested Scheduler loop and don't need a stack push! // not run a nested Scheduler loop and don't need a stack push!
pMostUrgent->mbInScheduler = true; pMostUrgent->mbInScheduler = true;
sal_uInt32 nLockCount = Unlock( true ); sal_uInt32 nLockCount = Unlock( true );
try
{
pTask->Invoke(); pTask->Invoke();
}
catch (...)
{
SAL_WARN( "vcl.schedule",
"Uncaught exception during Task::Invoke()!" );
abort();
}
Lock( nLockCount ); Lock( nLockCount );
pMostUrgent->mbInScheduler = false; pMostUrgent->mbInScheduler = false;
......
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