Bug 1377605 Cast -1 to DWORD to correctly match the error return value given by SuspendThread r?aklotz
MozReview-Commit-ID: 5XHgkpQJQKY
old mode 100644
new mode 100755
--- a/js/src/wasm/WasmSignalHandlers.cpp
+++ b/js/src/wasm/WasmSignalHandlers.cpp
@@ -1585,17 +1585,17 @@ js::InterruptRunningJitCode(JSContext* c
// We are not on the runtime's active thread, so to do 1 and 2 above, we need
// to halt the runtime's active thread first.
#if defined(XP_WIN)
// On Windows, we can simply suspend the active thread and work directly on
// its context from this thread. SuspendThread can sporadically fail if the
// thread is in the middle of a syscall. Rather than retrying in a loop,
// just wait for the next request for interrupt.
HANDLE thread = (HANDLE)cx->threadNative();
- if (SuspendThread(thread) != -1) {
+ if (SuspendThread(thread) != (DWORD)-1) {
CONTEXT context;
context.ContextFlags = CONTEXT_FULL;
if (GetThreadContext(thread, &context)) {
if (RedirectJitCodeToInterruptCheck(cx, &context))
SetThreadContext(thread, &context);
}
ResumeThread(thread);
}
--- a/mozglue/misc/StackWalk.cpp
+++ b/mozglue/misc/StackWalk.cpp
@@ -581,23 +581,23 @@ WalkStackThread(void* aData)
ret = ::WaitForSingleObject(data->eventStart, INFINITE);
if (ret != WAIT_OBJECT_0) {
PrintError("WaitForSingleObject");
}
// Suspend the calling thread, dump his stack, and then resume him.
// He's currently waiting for us to finish so now should be a good time.
ret = ::SuspendThread(data->thread);
- if (ret == -1) {
+ if (ret == (DWORD)-1) {
PrintError("ThreadSuspend");
} else {
WalkStackMain64(data);
ret = ::ResumeThread(data->thread);
- if (ret == -1) {
+ if (ret == (DWORD)-1) {
PrintError("ThreadResume");
}
}
::SetEvent(data->eventEnd);
}
}
old mode 100644
new mode 100755
--- a/xpcom/threads/HangMonitor.cpp
+++ b/xpcom/threads/HangMonitor.cpp
@@ -146,17 +146,17 @@ GetChromeHangReport(Telemetry::Processed
// The thread we're about to suspend might have the alloc lock
// so allocate ahead of time
std::vector<uintptr_t> rawStack;
rawStack.reserve(MAX_CALL_STACK_PCS);
DWORD ret = ::SuspendThread(winMainThreadHandle);
bool suspended = false;
- if (ret != -1) {
+ if (ret != (DWORD)-1) {
// SuspendThread is asynchronous, so the thread may still be running. Use
// GetThreadContext to ensure it's really suspended.
// See https://blogs.msdn.microsoft.com/oldnewthing/20150205-00/?p=44743.
CONTEXT context;
context.ContextFlags = CONTEXT_CONTROL;
if (::GetThreadContext(winMainThreadHandle, &context)) {
suspended = true;
}