| 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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 | 204 |
| 205 void OSThread::SetThreadLocal(ThreadLocalKey key, uword value) { | 205 void OSThread::SetThreadLocal(ThreadLocalKey key, uword value) { |
| 206 ASSERT(key != kUnsetThreadLocalKey); | 206 ASSERT(key != kUnsetThreadLocalKey); |
| 207 BOOL result = TlsSetValue(key, reinterpret_cast<void*>(value)); | 207 BOOL result = TlsSetValue(key, reinterpret_cast<void*>(value)); |
| 208 if (!result) { | 208 if (!result) { |
| 209 FATAL1("TlsSetValue failed %d", GetLastError()); | 209 FATAL1("TlsSetValue failed %d", GetLastError()); |
| 210 } | 210 } |
| 211 } | 211 } |
| 212 | 212 |
| 213 | 213 |
| 214 Mutex::Mutex() { | 214 Mutex::Mutex(bool recursive) { |
| 215 // TODO(fschneider): Create recursive mutex if requested. |
| 216 |
| 215 // Allocate unnamed semaphore with initial count 1 and max count 1. | 217 // Allocate unnamed semaphore with initial count 1 and max count 1. |
| 216 data_.semaphore_ = CreateSemaphore(NULL, 1, 1, NULL); | 218 data_.semaphore_ = CreateSemaphore(NULL, 1, 1, NULL); |
| 217 if (data_.semaphore_ == NULL) { | 219 if (data_.semaphore_ == NULL) { |
| 218 FATAL1("Mutex allocation failed %d", GetLastError()); | 220 FATAL1("Mutex allocation failed %d", GetLastError()); |
| 219 } | 221 } |
| 220 #if defined(DEBUG) | 222 #if defined(DEBUG) |
| 221 // When running with assertions enabled we do track the owner. | 223 // When running with assertions enabled we do track the owner. |
| 222 owner_ = OSThread::kInvalidThreadId; | 224 owner_ = OSThread::kInvalidThreadId; |
| 223 #endif // defined(DEBUG) | 225 #endif // defined(DEBUG) |
| 224 } | 226 } |
| (...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 696 #pragma data_seg(".CRT$XLB") | 698 #pragma data_seg(".CRT$XLB") |
| 697 PIMAGE_TLS_CALLBACK p_thread_callback_dart = OnDartThreadExit; | 699 PIMAGE_TLS_CALLBACK p_thread_callback_dart = OnDartThreadExit; |
| 698 | 700 |
| 699 // Reset the default section. | 701 // Reset the default section. |
| 700 #pragma data_seg() | 702 #pragma data_seg() |
| 701 | 703 |
| 702 #endif // _WIN64 | 704 #endif // _WIN64 |
| 703 } // extern "C" | 705 } // extern "C" |
| 704 | 706 |
| 705 #endif // defined(TARGET_OS_WINDOWS) | 707 #endif // defined(TARGET_OS_WINDOWS) |
| OLD | NEW |