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 "platform/globals.h" // NOLINT | 5 #include "platform/globals.h" // NOLINT |
6 #if defined(TARGET_OS_WINDOWS) | 6 #if defined(TARGET_OS_WINDOWS) |
7 | 7 |
8 #include "vm/growable_array.h" | 8 #include "vm/growable_array.h" |
9 #include "vm/os_thread.h" | 9 #include "vm/os_thread.h" |
10 | 10 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 #endif | 79 #endif |
80 return errno; | 80 return errno; |
81 } | 81 } |
82 | 82 |
83 // Close the handle, so we don't leak the thread object. | 83 // Close the handle, so we don't leak the thread object. |
84 CloseHandle(reinterpret_cast<HANDLE>(thread)); | 84 CloseHandle(reinterpret_cast<HANDLE>(thread)); |
85 | 85 |
86 return 0; | 86 return 0; |
87 } | 87 } |
88 | 88 |
89 ThreadLocalKey OSThread::kUnsetThreadLocalKey = TLS_OUT_OF_INDEXES; | 89 |
90 ThreadId OSThread::kInvalidThreadId = 0; | 90 const ThreadId OSThread::kInvalidThreadId = 0; |
91 ThreadJoinId OSThread::kInvalidThreadJoinId = 0; | 91 const ThreadJoinId OSThread::kInvalidThreadJoinId = 0; |
| 92 |
92 | 93 |
93 ThreadLocalKey OSThread::CreateThreadLocal(ThreadDestructor destructor) { | 94 ThreadLocalKey OSThread::CreateThreadLocal(ThreadDestructor destructor) { |
94 ThreadLocalKey key = TlsAlloc(); | 95 ThreadLocalKey key = TlsAlloc(); |
95 if (key == kUnsetThreadLocalKey) { | 96 if (key == kUnsetThreadLocalKey) { |
96 FATAL1("TlsAlloc failed %d", GetLastError()); | 97 FATAL1("TlsAlloc failed %d", GetLastError()); |
97 } | 98 } |
98 ThreadLocalData::AddThreadLocal(key, destructor); | 99 ThreadLocalData::AddThreadLocal(key, destructor); |
99 return key; | 100 return key; |
100 } | 101 } |
101 | 102 |
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
698 #pragma data_seg(".CRT$XLB") | 699 #pragma data_seg(".CRT$XLB") |
699 PIMAGE_TLS_CALLBACK p_thread_callback_dart = OnDartThreadExit; | 700 PIMAGE_TLS_CALLBACK p_thread_callback_dart = OnDartThreadExit; |
700 | 701 |
701 // Reset the default section. | 702 // Reset the default section. |
702 #pragma data_seg() | 703 #pragma data_seg() |
703 | 704 |
704 #endif // _WIN64 | 705 #endif // _WIN64 |
705 } // extern "C" | 706 } // extern "C" |
706 | 707 |
707 #endif // defined(TARGET_OS_WINDOWS) | 708 #endif // defined(TARGET_OS_WINDOWS) |
OLD | NEW |