| Index: runtime/vm/os_thread_win.cc
|
| diff --git a/runtime/vm/os_thread_win.cc b/runtime/vm/os_thread_win.cc
|
| index 52fbd983fe6bdd8c7a1463f1929f14d77d8927e2..7a29d0da46c27fe457788279a3651f183cd87fb4 100644
|
| --- a/runtime/vm/os_thread_win.cc
|
| +++ b/runtime/vm/os_thread_win.cc
|
| @@ -52,12 +52,14 @@ static unsigned int __stdcall ThreadEntry(void* data_ptr) {
|
| MonitorData::GetMonitorWaitDataForThread();
|
|
|
| // Create new OSThread object and set as TLS for new thread.
|
| - OSThread* thread = new OSThread();
|
| - OSThread::SetCurrent(thread);
|
| - thread->set_name(name);
|
| + OSThread* thread = OSThread::CreateOSThread();
|
| + if (thread != NULL) {
|
| + OSThread::SetCurrent(thread);
|
| + thread->set_name(name);
|
|
|
| - // Call the supplied thread start function handing it its parameters.
|
| - function(parameter);
|
| + // Call the supplied thread start function handing it its parameters.
|
| + function(parameter);
|
| + }
|
|
|
| // Clean up the monitor wait data for this thread.
|
| MonitorWaitData::ThreadExit();
|
|
|