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

Unified Diff: base/threading/platform_thread_posix.cc

Issue 14634009: Move Thread Name Mapping into ThreadFunc. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
Index: base/threading/platform_thread_posix.cc
diff --git a/base/threading/platform_thread_posix.cc b/base/threading/platform_thread_posix.cc
index 43e58b73375a0c3273422d9c28e10150d3835197..744019456c83115e7b7b1593d4ed94174ce47d71 100644
--- a/base/threading/platform_thread_posix.cc
+++ b/base/threading/platform_thread_posix.cc
@@ -46,6 +46,7 @@ struct ThreadParams {
PlatformThread::Delegate* delegate;
bool joinable;
ThreadPriority priority;
+ PlatformThreadHandle* thread_handle;
};
void SetCurrentThreadPriority(ThreadPriority priority) {
@@ -91,6 +92,10 @@ void* ThreadFunc(void* params) {
if (thread_params->priority != kThreadPriority_Normal)
SetCurrentThreadPriority(thread_params->priority);
+ ThreadIdNameManager::GetInstance()->RegisterThread(
+ thread_params->thread_handle,
+ PlatformThread::CurrentId());
+
delete thread_params;
delegate->ThreadMain();
#if defined(OS_ANDROID)
@@ -155,6 +160,7 @@ bool CreateThread(size_t stack_size, bool joinable,
params->delegate = delegate;
params->joinable = joinable;
params->priority = priority;
+ params->thread_handle = thread_handle;
int err = pthread_create(thread_handle, &attributes, ThreadFunc, params);
success = !err;

Powered by Google App Engine
This is Rietveld 408576698