OLD | NEW |
1 // Copyright (c) 2012, 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 "vm/globals.h" | 5 #include "vm/globals.h" |
6 #if defined(TARGET_OS_WINDOWS) | 6 #if defined(TARGET_OS_WINDOWS) |
7 | 7 |
8 #include "vm/os.h" | 8 #include "vm/os.h" |
9 #include "vm/vtune.h" | 9 #include "vm/vtune.h" |
10 | 10 |
11 #include <malloc.h> // NOLINT | 11 #include <malloc.h> // NOLINT |
12 #include <process.h> // NOLINT | 12 #include <process.h> // NOLINT |
13 #include <time.h> // NOLINT | 13 #include <time.h> // NOLINT |
14 | 14 |
15 #include "platform/utils.h" | 15 #include "platform/utils.h" |
16 #include "platform/assert.h" | 16 #include "platform/assert.h" |
| 17 #include "platform/thread.h" |
17 | 18 |
18 namespace dart { | 19 namespace dart { |
19 | 20 |
20 const char* OS::Name() { | 21 const char* OS::Name() { |
21 return "windows"; | 22 return "windows"; |
22 } | 23 } |
23 | 24 |
24 | 25 |
25 intptr_t OS::ProcessId() { | 26 intptr_t OS::ProcessId() { |
26 return static_cast<intptr_t>(GetCurrentProcessId()); | 27 return static_cast<intptr_t>(GetCurrentProcessId()); |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 | 299 |
299 void OS::InitOnce() { | 300 void OS::InitOnce() { |
300 // TODO(5411554): For now we check that initonce is called only once, | 301 // TODO(5411554): For now we check that initonce is called only once, |
301 // Once there is more formal mechanism to call InitOnce we can move | 302 // Once there is more formal mechanism to call InitOnce we can move |
302 // this check there. | 303 // this check there. |
303 static bool init_once_called = false; | 304 static bool init_once_called = false; |
304 ASSERT(init_once_called == false); | 305 ASSERT(init_once_called == false); |
305 init_once_called = true; | 306 init_once_called = true; |
306 // Do not pop up a message box when abort is called. | 307 // Do not pop up a message box when abort is called. |
307 _set_abort_behavior(0, _WRITE_ABORT_MSG); | 308 _set_abort_behavior(0, _WRITE_ABORT_MSG); |
| 309 ThreadInlineImpl::thread_id_key = Thread::CreateThreadLocal(); |
| 310 MonitorWaitData::monitor_wait_data_key_ = Thread::CreateThreadLocal(); |
| 311 MonitorData::GetMonitorWaitDataForThread(); |
| 312 ThreadId thread_id = ThreadInlineImpl::CreateThreadId(); |
| 313 Thread::SetThreadLocal(ThreadInlineImpl::thread_id_key, |
| 314 reinterpret_cast<DWORD>(thread_id)); |
308 } | 315 } |
309 | 316 |
310 | 317 |
311 void OS::Shutdown() { | 318 void OS::Shutdown() { |
312 } | 319 } |
313 | 320 |
314 | 321 |
315 void OS::Abort() { | 322 void OS::Abort() { |
316 abort(); | 323 abort(); |
317 } | 324 } |
318 | 325 |
319 | 326 |
320 void OS::Exit(int code) { | 327 void OS::Exit(int code) { |
321 exit(code); | 328 exit(code); |
322 } | 329 } |
323 | 330 |
324 } // namespace dart | 331 } // namespace dart |
325 | 332 |
326 #endif // defined(TARGET_OS_WINDOWS) | 333 #endif // defined(TARGET_OS_WINDOWS) |
OLD | NEW |