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

Side by Side Diff: runtime/bin/eventhandler_macos.cc

Issue 8742013: Only report poll failures when it is something we cannot recover from. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 9 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/bin/eventhandler_linux.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include <errno.h> 5 #include <errno.h>
6 #include <poll.h> 6 #include <poll.h>
7 #include <pthread.h> 7 #include <pthread.h>
8 #include <stdio.h> 8 #include <stdio.h>
9 #include <string.h> 9 #include <string.h>
10 #include <sys/time.h> 10 #include <sys/time.h>
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 void* EventHandlerImplementation::Poll(void* args) { 339 void* EventHandlerImplementation::Poll(void* args) {
340 intptr_t pollfds_size; 340 intptr_t pollfds_size;
341 struct pollfd* pollfds; 341 struct pollfd* pollfds;
342 EventHandlerImplementation* handler = 342 EventHandlerImplementation* handler =
343 reinterpret_cast<EventHandlerImplementation*>(args); 343 reinterpret_cast<EventHandlerImplementation*>(args);
344 while (1) { 344 while (1) {
345 pollfds = handler->GetPollFds(&pollfds_size); 345 pollfds = handler->GetPollFds(&pollfds_size);
346 intptr_t millis = handler->GetTimeout(); 346 intptr_t millis = handler->GetTimeout();
347 intptr_t result = poll(pollfds, pollfds_size, millis); 347 intptr_t result = poll(pollfds, pollfds_size, millis);
348 if (result == -1) { 348 if (result == -1) {
349 perror("Poll failed"); 349 if (errno != EAGAIN && errno != EINTR) {
350 perror("Poll failed");
351 }
350 } else { 352 } else {
351 handler->HandleTimeout(); 353 handler->HandleTimeout();
352 handler->HandleEvents(pollfds, pollfds_size, result); 354 handler->HandleEvents(pollfds, pollfds_size, result);
353 } 355 }
354 free(pollfds); 356 free(pollfds);
355 } 357 }
356 return NULL; 358 return NULL;
357 } 359 }
358 360
359 361
360 void EventHandlerImplementation::StartEventHandler() { 362 void EventHandlerImplementation::StartEventHandler() {
361 pthread_t handler_thread; 363 pthread_t handler_thread;
362 int result = pthread_create(&handler_thread, 364 int result = pthread_create(&handler_thread,
363 NULL, 365 NULL,
364 &EventHandlerImplementation::Poll, 366 &EventHandlerImplementation::Poll,
365 this); 367 this);
366 if (result != 0) { 368 if (result != 0) {
367 FATAL("Create start event handler thread"); 369 FATAL("Create start event handler thread");
368 } 370 }
369 } 371 }
370 372
371 373
372 void EventHandlerImplementation::SendData(intptr_t id, 374 void EventHandlerImplementation::SendData(intptr_t id,
373 Dart_Port dart_port, 375 Dart_Port dart_port,
374 intptr_t data) { 376 intptr_t data) {
375 WakeupHandler(id, dart_port, data); 377 WakeupHandler(id, dart_port, data);
376 } 378 }
OLDNEW
« no previous file with comments | « runtime/bin/eventhandler_linux.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698