Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(310)

Side by Side Diff: base/threading/platform_thread_win.cc

Issue 10398060: Base: Crash the process if we are not able to join threads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/threading/platform_thread.h" 5 #include "base/threading/platform_thread.h"
6 6
7 #include "base/debug/alias.h" 7 #include "base/debug/alias.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/threading/thread_local.h" 9 #include "base/threading/thread_local.h"
10 #include "base/threading/thread_restrictions.h" 10 #include "base/threading/thread_restrictions.h"
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 // Joining another thread may block the current thread for a long time, since 174 // Joining another thread may block the current thread for a long time, since
175 // the thread referred to by |thread_handle| may still be running long-lived / 175 // the thread referred to by |thread_handle| may still be running long-lived /
176 // blocking tasks. 176 // blocking tasks.
177 #if 0 177 #if 0
178 base::ThreadRestrictions::AssertIOAllowed(); 178 base::ThreadRestrictions::AssertIOAllowed();
179 #endif 179 #endif
180 180
181 // Wait for the thread to exit. It should already have terminated but make 181 // Wait for the thread to exit. It should already have terminated but make
182 // sure this assumption is valid. 182 // sure this assumption is valid.
183 DWORD result = WaitForSingleObject(thread_handle, INFINITE); 183 DWORD result = WaitForSingleObject(thread_handle, INFINITE);
184 DCHECK_EQ(WAIT_OBJECT_0, result); 184 if (result != WAIT_OBJECT_0) {
willchan no longer on Chromium 2012/05/16 20:15:50 Should we alias &result too?
185 // Debug info for bug 127931.
186 DWORD error = GetLastError();
187 debug::Alias(&error);
188 debug::Alias(&thread_handle);
189 CHECK(false) << "Failed to wait for thread";
willchan no longer on Chromium 2012/05/16 20:15:50 I'd be inclined to ditch the string since it bloat
190 }
185 191
186 CloseHandle(thread_handle); 192 CloseHandle(thread_handle);
187 } 193 }
188 194
189 // static 195 // static
190 void PlatformThread::SetThreadPriority(PlatformThreadHandle handle, 196 void PlatformThread::SetThreadPriority(PlatformThreadHandle handle,
191 ThreadPriority priority) { 197 ThreadPriority priority) {
192 switch (priority) { 198 switch (priority) {
193 case kThreadPriority_Normal: 199 case kThreadPriority_Normal:
194 ::SetThreadPriority(handle, THREAD_PRIORITY_NORMAL); 200 ::SetThreadPriority(handle, THREAD_PRIORITY_NORMAL);
195 break; 201 break;
196 case kThreadPriority_RealtimeAudio: 202 case kThreadPriority_RealtimeAudio:
197 ::SetThreadPriority(handle, THREAD_PRIORITY_TIME_CRITICAL); 203 ::SetThreadPriority(handle, THREAD_PRIORITY_TIME_CRITICAL);
198 break; 204 break;
199 } 205 }
200 } 206 }
201 207
202 } // namespace base 208 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698