зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1026580 - Remove an infinite loop possibility from AsyncTransactionTracker::WaitComplete() r=nical
This commit is contained in:
Родитель
98c189f1bf
Коммит
1ad1ef7739
|
@ -33,16 +33,21 @@ AsyncTransactionTracker::WaitComplete()
|
|||
|
||||
MonitorAutoLock mon(mCompletedMonitor);
|
||||
int count = 0;
|
||||
while (!mCompleted) {
|
||||
const int maxCount = 5;
|
||||
while (!mCompleted && (count < maxCount)) {
|
||||
if (!NS_SUCCEEDED(mCompletedMonitor.Wait(PR_MillisecondsToInterval(10000)))) {
|
||||
NS_WARNING("Failed to wait Monitor");
|
||||
return;
|
||||
}
|
||||
if (count > 1) {
|
||||
NS_WARNING("Waiting async transaction complete.");
|
||||
printf_stderr("Waiting async transaction complete.\n");
|
||||
}
|
||||
count++;
|
||||
}
|
||||
|
||||
if (!mCompleted) {
|
||||
printf_stderr("Timeout of waiting transaction complete.");
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Загрузка…
Ссылка в новой задаче