A couple comment updates
Add a comment to worker pool, as on first reading it I thought there was a bug with name going out of scope.
+ a minor fix the thread.h
BUG=None
TEST=None
Review URL: http://codereview.chromium.org/8463004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@109002 0039d316-1c4b-4281-b951-d872f2087c98
CrOS-Libchrome-Original-Commit: ab39dc873522a528d61532fe3ab98d0d012caaff
diff --git a/base/threading/thread.h b/base/threading/thread.h
index 535edd2..7ba3892 100644
--- a/base/threading/thread.h
+++ b/base/threading/thread.h
@@ -122,7 +122,7 @@
return message_loop_->message_loop_proxy();
}
- // Set the name of this thread (for display in debugger too).
+ // Returns the name of this thread (for display in debugger too).
const std::string &thread_name() { return name_; }
// The native thread handle.
diff --git a/base/threading/worker_pool_posix.cc b/base/threading/worker_pool_posix.cc
index 917565d..3ddc08c 100644
--- a/base/threading/worker_pool_posix.cc
+++ b/base/threading/worker_pool_posix.cc
@@ -78,6 +78,7 @@
void WorkerThread::ThreadMain() {
const std::string name = base::StringPrintf(
"%s/%d", name_prefix_.c_str(), PlatformThread::CurrentId());
+ // Note |name.c_str()| must remain valid for for the whole life of the thread.
PlatformThread::SetName(name.c_str());
for (;;) {