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 |