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

Unified Diff: runtime/bin/eventhandler_win.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_win.cc
diff --git a/runtime/bin/eventhandler_win.cc b/runtime/bin/eventhandler_win.cc
index 043db3c7a1d714128913f883f54ea4780cb17cd2..72311c109ed5a268a98321375b768cf9e353c64c 100644
--- a/runtime/bin/eventhandler_win.cc
+++ b/runtime/bin/eventhandler_win.cc
@@ -1,14 +1,15 @@
-// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// 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 <process.h>
#include <winsock2.h>
#include <ws2tcpip.h>
#include <mswsock.h>
#include "bin/builtin.h"
-#include "bin/eventhandler.h"
#include "bin/socket.h"
@@ -823,9 +824,10 @@ void EventHandlerImplementation::SendData(intptr_t id,
}
-static unsigned int __stdcall EventHandlerThread(void* args) {
+static void EventHandlerThread(uword args) {
EventHandlerImplementation* handler =
reinterpret_cast<EventHandlerImplementation*>(args);
+ ASSERT(handler != NULL);
while (true) {
DWORD bytes;
ULONG_PTR key;
@@ -877,11 +879,10 @@ static unsigned int __stdcall EventHandlerThread(void* args) {
void EventHandlerImplementation::StartEventHandler() {
- uint32_t tid;
- uintptr_t thread_handle =
- _beginthreadex(NULL, 32 * 1024, EventHandlerThread, this, 0, &tid);
- if (thread_handle == -1) {
- FATAL("Failed to start event handler thread");
+ int result = dart::Thread::Start(EventHandlerThread,
+ reinterpret_cast<uword>(this));
+ if (result != 0) {
+ FATAL1("Failed to start event handler thread %d", result);
}
// Initialize Winsock32

Powered by Google App Engine
This is Rietveld 408576698