OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 "bin/eventhandler.h" |
| 6 |
5 #include <process.h> | 7 #include <process.h> |
6 #include <winsock2.h> | 8 #include <winsock2.h> |
7 #include <ws2tcpip.h> | 9 #include <ws2tcpip.h> |
8 #include <mswsock.h> | 10 #include <mswsock.h> |
9 | 11 |
10 #include "bin/builtin.h" | 12 #include "bin/builtin.h" |
11 #include "bin/eventhandler.h" | |
12 #include "bin/socket.h" | 13 #include "bin/socket.h" |
13 | 14 |
14 | 15 |
15 static const int kInfinityTimeout = -1; | 16 static const int kInfinityTimeout = -1; |
16 | 17 |
17 | 18 |
18 int64_t GetCurrentTimeMilliseconds() { | 19 int64_t GetCurrentTimeMilliseconds() { |
19 static const int64_t kTimeEpoc = 116444736000000000LL; | 20 static const int64_t kTimeEpoc = 116444736000000000LL; |
20 | 21 |
21 // Although win32 uses 64-bit integers for representing timestamps, | 22 // Although win32 uses 64-bit integers for representing timestamps, |
(...skipping 848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
870 handler->HandleInterrupt(msg); | 871 handler->HandleInterrupt(msg); |
871 delete msg; | 872 delete msg; |
872 } else { | 873 } else { |
873 handler->HandleIOCompletion(bytes, key, overlapped); | 874 handler->HandleIOCompletion(bytes, key, overlapped); |
874 } | 875 } |
875 } | 876 } |
876 } | 877 } |
877 | 878 |
878 | 879 |
879 void EventHandlerImplementation::StartEventHandler() { | 880 void EventHandlerImplementation::StartEventHandler() { |
880 uint32_t tid; | 881 dart::Thread::Start(EventHandlerThread, |
881 uintptr_t thread_handle = | 882 reinterpret_cast<uword>(this)); |
882 _beginthreadex(NULL, 32 * 1024, EventHandlerThread, this, 0, &tid); | |
883 if (thread_handle == -1) { | |
884 FATAL("Failed to start event handler thread"); | |
885 } | |
886 | 883 |
887 // Initialize Winsock32 | 884 // Initialize Winsock32 |
888 if (!Socket::Initialize()) { | 885 if (!Socket::Initialize()) { |
889 FATAL("Failed to initialized Windows sockets"); | 886 FATAL("Failed to initialized Windows sockets"); |
890 } | 887 } |
891 } | 888 } |
OLD | NEW |