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 // Joining another thread may block the current thread for a long time, since | |
129 // the thread referred to by |thread_handle| may still be running long-lived / | |
130 // blocking tasks. | |
131 base::ThreadRestrictions::AssertIOAllowed(); | |
132 | 128 |
133 // Wait for the thread to exit. It should already have terminated but make | 129 // Wait for the thread to exit. It should already have terminated but make |
134 // sure this assumption is valid. | 130 // sure this assumption is valid. |
135 DWORD result = WaitForSingleObject(thread_handle, INFINITE); | 131 DWORD result = WaitForSingleObject(thread_handle, INFINITE); |
136 DCHECK_EQ(WAIT_OBJECT_0, result); | 132 DCHECK_EQ(WAIT_OBJECT_0, result); |
137 | 133 |
138 CloseHandle(thread_handle); | 134 CloseHandle(thread_handle); |
139 } | 135 } |
OLD | NEW |