Bug 1252382 - Get rid of PR_Sleep in the terminator;r=froydnj

The terminator currently makes use of PR_Sleep. As it turns out, late
in shutdown, this can cause infinite recursions and finally exit(-11) . This
patch replaces PR_Sleep with usleep(3) and Sleep().

MozReview-Commit-ID: 3SybinpQUVl

--HG--
extra : rebase_source : 61bd6cc1cac6fc51729f0e04867a161cc9c9ea3d
This commit is contained in:
David Rajchenbach-Teller 2016-03-01 09:01:22 +01:00
Родитель 7fdebd3973
Коммит 278ae1aa6f
1 изменённых файлов: 11 добавлений и 2 удалений

Просмотреть файл

@ -33,6 +33,12 @@
#include "nsExceptionHandler.h" #include "nsExceptionHandler.h"
#endif #endif
#if defined(XP_WIN)
#include <windows.h>
#else
#include <unistd.h>
#endif
#include "mozilla/ArrayUtils.h" #include "mozilla/ArrayUtils.h"
#include "mozilla/Attributes.h" #include "mozilla/Attributes.h"
#include "mozilla/DebugOnly.h" #include "mozilla/DebugOnly.h"
@ -127,7 +133,6 @@ RunWatchdog(void* arg)
options = nullptr; options = nullptr;
const uint32_t timeToLive = crashAfterTicks; const uint32_t timeToLive = crashAfterTicks;
const PRIntervalTime ticksDuration = PR_MillisecondsToInterval(1000);
while (true) { while (true) {
// //
// We do not want to sleep for the entire duration, // We do not want to sleep for the entire duration,
@ -139,7 +144,11 @@ RunWatchdog(void* arg)
// we have lost at most one second, which is much // we have lost at most one second, which is much
// more reasonable. // more reasonable.
// //
PR_Sleep(ticksDuration); #if defined(XP_WIN)
Sleep(1000 /* ms */);
#else
usleep(1000000 /* usec */);
#endif
if (gHeartbeat++ < timeToLive) { if (gHeartbeat++ < timeToLive) {
continue; continue;