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

Unified Diff: base/threading/platform_thread_win.cc

Issue 1350493002: Check for CloseHandle failures even when not debugging (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: DCHECK to CHECK Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: base/threading/platform_thread_win.cc
diff --git a/base/threading/platform_thread_win.cc b/base/threading/platform_thread_win.cc
index 25973bcada928651091da0fa7025356f34604602..dc36a140447a68523fd1f58be0aef64715fae33c 100644
--- a/base/threading/platform_thread_win.cc
+++ b/base/threading/platform_thread_win.cc
@@ -114,17 +114,15 @@ bool CreateThreadInternal(size_t stack_size,
// have to work running on CreateThread() threads anyway, since we run code
// on the Windows thread pool, etc. For some background on the difference:
// http://www.microsoft.com/msj/1099/win32/win321099.aspx
- void* thread_handle =
- ::CreateThread(nullptr, stack_size, ThreadFunc, params, flags, nullptr);
- if (!thread_handle) {
+ base::win::ScopedHandle thread_handle(
+ ::CreateThread(nullptr, stack_size, ThreadFunc, params, flags, nullptr));
+ if (!thread_handle.IsValid()) {
delete params;
return false;
}
if (out_thread_handle)
- *out_thread_handle = PlatformThreadHandle(thread_handle);
- else
- CloseHandle(thread_handle);
+ *out_thread_handle = PlatformThreadHandle(thread_handle.Take());
return true;
}

Powered by Google App Engine
This is Rietveld 408576698