Chromium Code Reviews| Index: runtime/vm/os_thread.cc |
| diff --git a/runtime/vm/os_thread.cc b/runtime/vm/os_thread.cc |
| index 766bbbed97d9f46800e24be459df8d8e0f2b6fe0..f6a7498280a6a2545b49266a08391066d99aced8 100644 |
| --- a/runtime/vm/os_thread.cc |
| +++ b/runtime/vm/os_thread.cc |
| @@ -36,14 +36,18 @@ OSThread::OSThread() : |
| OSThread* OSThread::CreateOSThread() { |
| - ASSERT(thread_list_lock_ != NULL); |
| - MutexLocker ml(thread_list_lock_); |
| - if (!creation_enabled_) { |
| + if (thread_list_lock_ == NULL) { |
| return NULL; |
| } |
| - OSThread* os_thread = new OSThread(); |
| - AddThreadToListLocked(os_thread); |
| - return os_thread; |
| + { |
| + MutexLocker ml(thread_list_lock_); |
|
Vyacheslav Egorov (Google)
2016/01/02 16:41:30
Code like this is a red-flag in multithreaded envi
zra
2016/01/04 17:19:10
Acknowledged.
|
| + if (!creation_enabled_) { |
| + return NULL; |
| + } |
| + OSThread* os_thread = new OSThread(); |
| + AddThreadToListLocked(os_thread); |
| + return os_thread; |
| + } |
| } |