OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/platform_thread.h" | 5 #include "base/platform_thread.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/thread_restrictions.h" | 8 #include "base/thread_restrictions.h" |
9 #include "base/win/windows_version.h" | 9 #include "base/win/windows_version.h" |
10 | 10 |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 } | 118 } |
119 | 119 |
120 // static | 120 // static |
121 bool PlatformThread::CreateNonJoinable(size_t stack_size, Delegate* delegate) { | 121 bool PlatformThread::CreateNonJoinable(size_t stack_size, Delegate* delegate) { |
122 return CreateThreadInternal(stack_size, delegate, NULL); | 122 return CreateThreadInternal(stack_size, delegate, NULL); |
123 } | 123 } |
124 | 124 |
125 // static | 125 // static |
126 void PlatformThread::Join(PlatformThreadHandle thread_handle) { | 126 void PlatformThread::Join(PlatformThreadHandle thread_handle) { |
127 DCHECK(thread_handle); | 127 DCHECK(thread_handle); |
| 128 // TODO(willchan): Enable this check once I can get it to work for Windows |
| 129 // shutdown. |
| 130 // Joining another thread may block the current thread for a long time, since |
| 131 // the thread referred to by |thread_handle| may still be running long-lived / |
| 132 // blocking tasks. |
| 133 #if 0 |
| 134 base::ThreadRestrictions::AssertIOAllowed(); |
| 135 #endif |
128 | 136 |
129 // Wait for the thread to exit. It should already have terminated but make | 137 // Wait for the thread to exit. It should already have terminated but make |
130 // sure this assumption is valid. | 138 // sure this assumption is valid. |
131 DWORD result = WaitForSingleObject(thread_handle, INFINITE); | 139 DWORD result = WaitForSingleObject(thread_handle, INFINITE); |
132 DCHECK_EQ(WAIT_OBJECT_0, result); | 140 DCHECK_EQ(WAIT_OBJECT_0, result); |
133 | 141 |
134 CloseHandle(thread_handle); | 142 CloseHandle(thread_handle); |
135 } | 143 } |
OLD | NEW |