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

Unified Diff: dart/runtime/bin/eventhandler_android.cc

Issue 875403006: Wait for eventhandler to shut down before exiting (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 5 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
Index: dart/runtime/bin/eventhandler_android.cc
diff --git a/dart/runtime/bin/eventhandler_android.cc b/dart/runtime/bin/eventhandler_android.cc
index 680bcae7b99bf6cf8125ca688efb1f63b772c78c..a4ac240047dfdca750dd6718b102a2d012ebf242 100644
--- a/dart/runtime/bin/eventhandler_android.cc
+++ b/dart/runtime/bin/eventhandler_android.cc
@@ -299,25 +299,27 @@ void EventHandlerImplementation::Poll(uword args) {
ThreadSignalBlocker signal_blocker(SIGPROF);
static const intptr_t kMaxEvents = 16;
struct epoll_event events[kMaxEvents];
- EventHandlerImplementation* handler =
- reinterpret_cast<EventHandlerImplementation*>(args);
kustermann 2015/02/04 20:58:43 This was a bad cast, it just happens by accident t
- ASSERT(handler != NULL);
- while (!handler->shutdown_) {
- int64_t millis = handler->GetTimeout();
+ EventHandler* handler = reinterpret_cast<EventHandler*>(args);
+ EventHandlerImplementation* handler_impl = &handler->delegate_;
+ ASSERT(handler_impl != NULL);
+
+ while (!handler_impl->shutdown_) {
+ int64_t millis = handler_impl->GetTimeout();
ASSERT(millis == kInfinityTimeout || millis >= 0);
if (millis > kMaxInt32) millis = kMaxInt32;
intptr_t result = TEMP_FAILURE_RETRY_NO_SIGNAL_BLOCKER(
- epoll_wait(handler->epoll_fd_, events, kMaxEvents, millis));
+ epoll_wait(handler_impl->epoll_fd_, events, kMaxEvents, millis));
ASSERT(EAGAIN == EWOULDBLOCK);
if (result == -1) {
if (errno != EWOULDBLOCK) {
perror("Poll failed");
}
} else {
- handler->HandleTimeout();
- handler->HandleEvents(events, result);
+ handler_impl->HandleTimeout();
+ handler_impl->HandleEvents(events, result);
}
}
+ handler->NotifyShutdownDone();
}

Powered by Google App Engine
This is Rietveld 408576698