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

Unified Diff: runtime/bin/eventhandler_macos.cc

Issue 9141005: Change the thread interface in runtime/platform and use it starting all threads (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments from asiva@ Created 8 years, 11 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: runtime/bin/eventhandler_macos.cc
diff --git a/runtime/bin/eventhandler_macos.cc b/runtime/bin/eventhandler_macos.cc
index 2e2ad9d5c07d71e47876181281a5d3b6d4f6affb..30626996ca6bff20341c5b5aa0c774d2b41386a7 100644
--- a/runtime/bin/eventhandler_macos.cc
+++ b/runtime/bin/eventhandler_macos.cc
@@ -2,6 +2,8 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+#include "bin/eventhandler.h"
+
#include <errno.h>
#include <poll.h>
#include <pthread.h>
@@ -10,7 +12,6 @@
#include <sys/time.h>
#include <unistd.h>
-#include "bin/eventhandler.h"
#include "bin/fdutils.h"
#include "bin/hashmap.h"
#include "platform/utils.h"
@@ -334,11 +335,12 @@ void EventHandlerImplementation::HandleTimeout() {
}
-void* EventHandlerImplementation::Poll(void* args) {
+void EventHandlerImplementation::Poll(uword args) {
intptr_t pollfds_size;
struct pollfd* pollfds;
EventHandlerImplementation* handler =
reinterpret_cast<EventHandlerImplementation*>(args);
+ ASSERT(handler != NULL);
while (1) {
pollfds = handler->GetPollFds(&pollfds_size);
intptr_t millis = handler->GetTimeout();
@@ -354,18 +356,14 @@ void* EventHandlerImplementation::Poll(void* args) {
}
free(pollfds);
}
- return NULL;
}
void EventHandlerImplementation::StartEventHandler() {
- pthread_t handler_thread;
- int result = pthread_create(&handler_thread,
- NULL,
- &EventHandlerImplementation::Poll,
- this);
+ int result = dart::Thread::Start(&EventHandlerImplementation::Poll,
+ reinterpret_cast<uword>(this));
if (result != 0) {
- FATAL("Create start event handler thread");
+ FATAL1("Failed to start event handler thread %d", result);
}
}

Powered by Google App Engine
This is Rietveld 408576698