Index: runtime/vm/os_thread_macos.cc |
diff --git a/runtime/vm/os_thread_macos.cc b/runtime/vm/os_thread_macos.cc |
index 2fa58d85456e73334b5501e2b501079ca4070e90..1964f64c84495e34b5bb34cfafa990fffae82897 100644 |
--- a/runtime/vm/os_thread_macos.cc |
+++ b/runtime/vm/os_thread_macos.cc |
@@ -88,12 +88,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; |
} |