Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(468)

Unified Diff: runtime/bin/eventhandler_macos.cc

Issue 9350034: Fix kqueue handling of no timeout (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/eventhandler_macos.cc
diff --git a/runtime/bin/eventhandler_macos.cc b/runtime/bin/eventhandler_macos.cc
index 4f74206c3decc0e1564538708b72e4fc709545e1..f93409235fbd3bdabd9326c70f732b150ed21c6a 100644
--- a/runtime/bin/eventhandler_macos.cc
+++ b/runtime/bin/eventhandler_macos.cc
@@ -344,21 +344,21 @@ void EventHandlerImplementation::EventHandlerEntry(uword args) {
ASSERT(handler != NULL);
while (1) {
intptr_t millis = handler->GetTimeout();
+ // NULL pointer timespec for infinite timeout.
+ ASSERT(kInfinityTimeout < 0);
+ struct timespec* timeout = NULL;
struct timespec ts;
- int64_t secs = 0;
- int64_t nanos = 0;
- if (millis > 0) {
- secs = millis / 1000;
- nanos = (millis - (secs * 1000)) * 1000000;
+ if (millis >= 0) {
+ ts.tv_sec = millis / 1000;
+ ts.tv_nsec = (millis - (ts.tv_sec * 1000)) * 1000000;
+ timeout = &ts;
}
- ts.tv_sec = secs;
- ts.tv_nsec = nanos;
intptr_t result = TEMP_FAILURE_RETRY(kevent(handler->kqueue_fd_,
NULL,
0,
events,
kMaxEvents,
- &ts));
+ timeout));
if (result == -1) {
perror("kevent failed");
FATAL("kevent failed\n");
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698