| 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/lockers.h" | 9 #include "vm/lockers.h" |
| 10 #include "vm/os_thread.h" | 10 #include "vm/os_thread.h" |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 owner_ = OSThread::kInvalidThreadId; | 307 owner_ = OSThread::kInvalidThreadId; |
| 308 #endif // defined(DEBUG) | 308 #endif // defined(DEBUG) |
| 309 | 309 |
| 310 LeaveCriticalSection(&data_.cs_); | 310 LeaveCriticalSection(&data_.cs_); |
| 311 } | 311 } |
| 312 | 312 |
| 313 | 313 |
| 314 void MonitorWaitData::ThreadExit() { | 314 void MonitorWaitData::ThreadExit() { |
| 315 if (MonitorWaitData::monitor_wait_data_key_ != kUnsetThreadLocalKey) { | 315 if (MonitorWaitData::monitor_wait_data_key_ != kUnsetThreadLocalKey) { |
| 316 uword raw_wait_data = | 316 uword raw_wait_data = |
| 317 OSThread::GetThreadLocal(MonitorWaitData::monitor_wait_data_key_); | 317 OSThread::GetThreadLocal(MonitorWaitData::monitor_wait_data_key_); |
| 318 // Clear in case this is called a second time. | 318 // Clear in case this is called a second time. |
| 319 OSThread::SetThreadLocal(MonitorWaitData::monitor_wait_data_key_, 0); | 319 OSThread::SetThreadLocal(MonitorWaitData::monitor_wait_data_key_, 0); |
| 320 if (raw_wait_data != 0) { | 320 if (raw_wait_data != 0) { |
| 321 MonitorWaitData* wait_data = | 321 MonitorWaitData* wait_data = |
| 322 reinterpret_cast<MonitorWaitData*>(raw_wait_data); | 322 reinterpret_cast<MonitorWaitData*>(raw_wait_data); |
| 323 delete wait_data; | 323 delete wait_data; |
| 324 } | 324 } |
| 325 } | 325 } |
| 326 } | 326 } |
| 327 | 327 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 | 418 |
| 419 | 419 |
| 420 MonitorWaitData* MonitorData::GetMonitorWaitDataForThread() { | 420 MonitorWaitData* MonitorData::GetMonitorWaitDataForThread() { |
| 421 // Ensure that the thread local key for monitor wait data objects is | 421 // Ensure that the thread local key for monitor wait data objects is |
| 422 // initialized. | 422 // initialized. |
| 423 ASSERT(MonitorWaitData::monitor_wait_data_key_ != kUnsetThreadLocalKey); | 423 ASSERT(MonitorWaitData::monitor_wait_data_key_ != kUnsetThreadLocalKey); |
| 424 | 424 |
| 425 // Get the MonitorWaitData object containing the event for this | 425 // Get the MonitorWaitData object containing the event for this |
| 426 // thread from thread local storage. Create it if it does not exist. | 426 // thread from thread local storage. Create it if it does not exist. |
| 427 uword raw_wait_data = | 427 uword raw_wait_data = |
| 428 OSThread::GetThreadLocal(MonitorWaitData::monitor_wait_data_key_); | 428 OSThread::GetThreadLocal(MonitorWaitData::monitor_wait_data_key_); |
| 429 MonitorWaitData* wait_data = NULL; | 429 MonitorWaitData* wait_data = NULL; |
| 430 if (raw_wait_data == 0) { | 430 if (raw_wait_data == 0) { |
| 431 HANDLE event = CreateEvent(NULL, FALSE, FALSE, NULL); | 431 HANDLE event = CreateEvent(NULL, FALSE, FALSE, NULL); |
| 432 wait_data = new MonitorWaitData(event); | 432 wait_data = new MonitorWaitData(event); |
| 433 OSThread::SetThreadLocal(MonitorWaitData::monitor_wait_data_key_, | 433 OSThread::SetThreadLocal(MonitorWaitData::monitor_wait_data_key_, |
| 434 reinterpret_cast<uword>(wait_data)); | 434 reinterpret_cast<uword>(wait_data)); |
| 435 } else { | 435 } else { |
| 436 wait_data = reinterpret_cast<MonitorWaitData*>(raw_wait_data); | 436 wait_data = reinterpret_cast<MonitorWaitData*>(raw_wait_data); |
| 437 wait_data->next_ = NULL; | 437 wait_data->next_ = NULL; |
| 438 } | 438 } |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 679 #pragma data_seg(".CRT$XLB") | 679 #pragma data_seg(".CRT$XLB") |
| 680 PIMAGE_TLS_CALLBACK p_thread_callback_dart = OnDartThreadExit; | 680 PIMAGE_TLS_CALLBACK p_thread_callback_dart = OnDartThreadExit; |
| 681 | 681 |
| 682 // Reset the default section. | 682 // Reset the default section. |
| 683 #pragma data_seg() | 683 #pragma data_seg() |
| 684 | 684 |
| 685 #endif // _WIN64 | 685 #endif // _WIN64 |
| 686 } // extern "C" | 686 } // extern "C" |
| 687 | 687 |
| 688 #endif // defined(TARGET_OS_WINDOWS) | 688 #endif // defined(TARGET_OS_WINDOWS) |
| OLD | NEW |