CID 10361: Slight code simplification to remove superfluous for loop.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40266 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
ef83c28376
commit
67a473f7d5
@ -356,38 +356,29 @@ BStatusWindow::CheckCanceledOrPaused(thread_id thread)
|
|||||||
|
|
||||||
BStatusView* view = NULL;
|
BStatusView* view = NULL;
|
||||||
|
|
||||||
for (;;) {
|
AutoLock<BWindow> lock(this);
|
||||||
|
// check if cancel or pause hit
|
||||||
AutoLock<BWindow> lock(this);
|
for (int32 index = fViewList.CountItems() - 1; index >= 0; index--) {
|
||||||
// check if cancel or pause hit
|
view = fViewList.ItemAt(index);
|
||||||
for (int32 index = fViewList.CountItems() - 1; index >= 0; index--) {
|
if (view && view->Thread() == thread) {
|
||||||
|
isPaused = view->IsPaused();
|
||||||
view = fViewList.ItemAt(index);
|
wasCanceled = view->WasCanceled();
|
||||||
if (view && view->Thread() == thread) {
|
|
||||||
isPaused = view->IsPaused();
|
|
||||||
wasCanceled = view->WasCanceled();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
lock.Unlock();
|
|
||||||
|
|
||||||
if (wasCanceled || !isPaused)
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (isPaused && view != NULL) {
|
|
||||||
AutoLock<BWindow> lock(this);
|
|
||||||
// say we are paused
|
|
||||||
view->Invalidate();
|
|
||||||
lock.Unlock();
|
|
||||||
|
|
||||||
ASSERT(find_thread(NULL) == view->Thread());
|
|
||||||
|
|
||||||
// and suspend ourselves
|
|
||||||
// we will get resumend from BStatusView::MessageReceived
|
|
||||||
suspend_thread(view->Thread());
|
|
||||||
}
|
}
|
||||||
break;
|
}
|
||||||
|
|
||||||
|
if (wasCanceled || !isPaused)
|
||||||
|
return wasCanceled;
|
||||||
|
|
||||||
|
if (isPaused && view != NULL) {
|
||||||
|
// say we are paused
|
||||||
|
view->Invalidate();
|
||||||
|
|
||||||
|
ASSERT(find_thread(NULL) == view->Thread());
|
||||||
|
|
||||||
|
// and suspend ourselves
|
||||||
|
// we will get resumed from BStatusView::MessageReceived
|
||||||
|
suspend_thread(view->Thread());
|
||||||
}
|
}
|
||||||
|
|
||||||
return wasCanceled;
|
return wasCanceled;
|
||||||
|
Loading…
Reference in New Issue
Block a user