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:
@@ -356,12 +356,9 @@ BStatusWindow::CheckCanceledOrPaused(thread_id thread)
|
|||||||
|
|
||||||
BStatusView* view = NULL;
|
BStatusView* view = NULL;
|
||||||
|
|
||||||
for (;;) {
|
|
||||||
|
|
||||||
AutoLock<BWindow> lock(this);
|
AutoLock<BWindow> lock(this);
|
||||||
// check if cancel or pause hit
|
// check if cancel or pause hit
|
||||||
for (int32 index = fViewList.CountItems() - 1; index >= 0; index--) {
|
for (int32 index = fViewList.CountItems() - 1; index >= 0; index--) {
|
||||||
|
|
||||||
view = fViewList.ItemAt(index);
|
view = fViewList.ItemAt(index);
|
||||||
if (view && view->Thread() == thread) {
|
if (view && view->Thread() == thread) {
|
||||||
isPaused = view->IsPaused();
|
isPaused = view->IsPaused();
|
||||||
@@ -369,26 +366,20 @@ BStatusWindow::CheckCanceledOrPaused(thread_id thread)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
lock.Unlock();
|
|
||||||
|
|
||||||
if (wasCanceled || !isPaused)
|
if (wasCanceled || !isPaused)
|
||||||
break;
|
return wasCanceled;
|
||||||
|
|
||||||
if (isPaused && view != NULL) {
|
if (isPaused && view != NULL) {
|
||||||
AutoLock<BWindow> lock(this);
|
|
||||||
// say we are paused
|
// say we are paused
|
||||||
view->Invalidate();
|
view->Invalidate();
|
||||||
lock.Unlock();
|
|
||||||
|
|
||||||
ASSERT(find_thread(NULL) == view->Thread());
|
ASSERT(find_thread(NULL) == view->Thread());
|
||||||
|
|
||||||
// and suspend ourselves
|
// and suspend ourselves
|
||||||
// we will get resumend from BStatusView::MessageReceived
|
// we will get resumed from BStatusView::MessageReceived
|
||||||
suspend_thread(view->Thread());
|
suspend_thread(view->Thread());
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return wasCanceled;
|
return wasCanceled;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user