Index: runtime/bin/eventhandler_macos.cc |
diff --git a/runtime/bin/eventhandler_macos.cc b/runtime/bin/eventhandler_macos.cc |
index 6823ef878ff14d8b2032cbec4ddee3e742ad5095..63926d82f30373d75961fb21b584d31fceaf140e 100644 |
--- a/runtime/bin/eventhandler_macos.cc |
+++ b/runtime/bin/eventhandler_macos.cc |
@@ -350,11 +350,11 @@ void EventHandlerImplementation::HandleEvents(struct kevent* events, |
} |
-intptr_t EventHandlerImplementation::GetTimeout() { |
+int64_t EventHandlerImplementation::GetTimeout() { |
if (timeout_ == kInfinityTimeout) { |
return kInfinityTimeout; |
} |
- intptr_t millis = timeout_ - TimerUtils::GetCurrentTimeMilliseconds(); |
+ int64_t millis = timeout_ - TimerUtils::GetCurrentTimeMilliseconds(); |
return (millis < 0) ? 0 : millis; |
} |
@@ -378,7 +378,9 @@ void EventHandlerImplementation::EventHandlerEntry(uword args) { |
EventHandlerImplementation* handler_impl = &handler->delegate_; |
ASSERT(handler_impl != NULL); |
while (!handler_impl->shutdown_) { |
- intptr_t millis = handler_impl->GetTimeout(); |
+ int64_t millis = handler_impl->GetTimeout(); |
+ ASSERT(millis == kInfinityTimeout || millis >= 0); |
+ if (millis > kMaxInt32) millis = kMaxInt32; |
// NULL pointer timespec for infinite timeout. |
ASSERT(kInfinityTimeout < 0); |
struct timespec* timeout = NULL; |