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

Unified Diff: base/platform_thread_win.cc

Issue 9059: Use CreateThread instead of _beginthreadex. This should still be safe, and w... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 12 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/platform_thread_win.cc
===================================================================
--- base/platform_thread_win.cc (revision 4461)
+++ base/platform_thread_win.cc (working copy)
@@ -22,7 +22,7 @@
DWORD dwFlags; // Reserved for future use, must be zero.
} THREADNAME_INFO;
-unsigned __stdcall ThreadFunc(void* closure) {
+DWORD __stdcall ThreadFunc(void* closure) {
PlatformThread::Delegate* delegate =
static_cast<PlatformThread::Delegate*>(closure);
delegate->ThreadMain();
@@ -50,7 +50,7 @@
void PlatformThread::SetName(const char* name) {
// The debugger needs to be around to catch the name in the exception. If
// there isn't a debugger, we are just needlessly throwing an exception.
- if (!::IsDebuggerPresent())
+ if (0 && !::IsDebuggerPresent())
Peter Kasting 2008/11/03 22:09:32 Did you mean this change to be part of this CL? L
return;
THREADNAME_INFO info;
@@ -76,8 +76,13 @@
stack_size = 0;
}
- *thread_handle = reinterpret_cast<PlatformThreadHandle>(_beginthreadex(
- NULL, stack_size, ThreadFunc, delegate, flags, NULL));
+ // Using CreateThread here vs _beginthreadex makes thread creation a bit
+ // faster and doesn't require holding the loader lock. Our code will have
tommi (sloooow) - chröme 2008/11/30 05:29:33 hi... really late, drive by comment here. I notic
+ // 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
M-A Ruel 2008/11/03 22:22:11 Add these links too: http://msdn.microsoft.com/en-
+ *thread_handle = CreateThread(
+ NULL, stack_size, ThreadFunc, delegate, flags, NULL);
return *thread_handle != NULL;
}
« 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