mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 842411 - Fire operation callback before time is up so we can test the non-aborting case (r=terrence)
--HG-- extra : rebase_source : 9f23aa8fc1be361f55b2db3943d20d510730fb7a
This commit is contained in:
parent
6eb14a7f48
commit
56936d2740
@ -2840,26 +2840,34 @@ WatchdogMain(void *arg)
|
||||
|
||||
PR_Lock(gWatchdogLock);
|
||||
while (gWatchdogThread) {
|
||||
int64_t now = PRMJ_Now();
|
||||
if (gWatchdogHasTimeout && !IsBefore(now, gWatchdogTimeout)) {
|
||||
/*
|
||||
* The timeout has just expired. Trigger the operation callback
|
||||
* outside the lock.
|
||||
*/
|
||||
gWatchdogHasTimeout = false;
|
||||
PR_Unlock(gWatchdogLock);
|
||||
CancelExecution(rt);
|
||||
PR_Lock(gWatchdogLock);
|
||||
int64_t now = PRMJ_Now();
|
||||
if (gWatchdogHasTimeout && !IsBefore(now, gWatchdogTimeout)) {
|
||||
/*
|
||||
* The timeout has just expired. Trigger the operation callback
|
||||
* outside the lock.
|
||||
*/
|
||||
gWatchdogHasTimeout = false;
|
||||
PR_Unlock(gWatchdogLock);
|
||||
CancelExecution(rt);
|
||||
PR_Lock(gWatchdogLock);
|
||||
|
||||
/* Wake up any threads doing sleep. */
|
||||
PR_NotifyAllCondVar(gSleepWakeup);
|
||||
/* Wake up any threads doing sleep. */
|
||||
PR_NotifyAllCondVar(gSleepWakeup);
|
||||
} else {
|
||||
uint64_t sleepDuration = PR_INTERVAL_NO_TIMEOUT;
|
||||
if (gWatchdogHasTimeout)
|
||||
sleepDuration = (gWatchdogTimeout - now) / PRMJ_USEC_PER_SEC * PR_TicksPerSecond();
|
||||
mozilla::DebugOnly<PRStatus> status =
|
||||
PR_WaitCondVar(gWatchdogWakeup, sleepDuration);
|
||||
JS_ASSERT(status == PR_SUCCESS);
|
||||
if (gWatchdogHasTimeout) {
|
||||
/*
|
||||
* Time hasn't expired yet. Simulate an operation callback
|
||||
* which doesn't abort execution.
|
||||
*/
|
||||
JS_TriggerOperationCallback(rt);
|
||||
}
|
||||
|
||||
uint64_t sleepDuration = PR_INTERVAL_NO_TIMEOUT;
|
||||
if (gWatchdogHasTimeout)
|
||||
sleepDuration = PR_TicksPerSecond() / 10;
|
||||
mozilla::DebugOnly<PRStatus> status =
|
||||
PR_WaitCondVar(gWatchdogWakeup, sleepDuration);
|
||||
JS_ASSERT(status == PR_SUCCESS);
|
||||
}
|
||||
}
|
||||
PR_Unlock(gWatchdogLock);
|
||||
|
Loading…
Reference in New Issue
Block a user