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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 ThreadStartData* data = reinterpret_cast<ThreadStartData*>(data_ptr); | 45 ThreadStartData* data = reinterpret_cast<ThreadStartData*>(data_ptr); |
46 | 46 |
47 const char* name = data->name(); | 47 const char* name = data->name(); |
48 OSThread::ThreadStartFunction function = data->function(); | 48 OSThread::ThreadStartFunction function = data->function(); |
49 uword parameter = data->parameter(); | 49 uword parameter = data->parameter(); |
50 delete data; | 50 delete data; |
51 | 51 |
52 MonitorData::GetMonitorWaitDataForThread(); | 52 MonitorData::GetMonitorWaitDataForThread(); |
53 | 53 |
54 // Create new OSThread object and set as TLS for new thread. | 54 // Create new OSThread object and set as TLS for new thread. |
55 OSThread* thread = new OSThread(); | 55 OSThread* thread = OSThread::CreateOSThread(); |
56 OSThread::SetCurrent(thread); | 56 if (thread != NULL) { |
57 thread->set_name(name); | 57 OSThread::SetCurrent(thread); |
| 58 thread->set_name(name); |
58 | 59 |
59 // Call the supplied thread start function handing it its parameters. | 60 // Call the supplied thread start function handing it its parameters. |
60 function(parameter); | 61 function(parameter); |
| 62 } |
61 | 63 |
62 // Clean up the monitor wait data for this thread. | 64 // Clean up the monitor wait data for this thread. |
63 MonitorWaitData::ThreadExit(); | 65 MonitorWaitData::ThreadExit(); |
64 | 66 |
65 return 0; | 67 return 0; |
66 } | 68 } |
67 | 69 |
68 | 70 |
69 int OSThread::Start(const char* name, | 71 int OSThread::Start(const char* name, |
70 ThreadStartFunction function, | 72 ThreadStartFunction function, |
(...skipping 625 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 |