Index: runtime/vm/os_thread_linux.cc |
diff --git a/runtime/vm/os_thread_linux.cc b/runtime/vm/os_thread_linux.cc |
index 4a08b84d2377ef98e2670088e5d5251bac760f31..f82123306e0c9d8141b3810da7edf58869f618a3 100644 |
--- a/runtime/vm/os_thread_linux.cc |
+++ b/runtime/vm/os_thread_linux.cc |
@@ -97,12 +97,14 @@ static void* ThreadStart(void* data_ptr) { |
delete data; |
// 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); |
+ } |
return NULL; |
} |