Index: base/threading/thread.h |
diff --git a/base/threading/thread.h b/base/threading/thread.h |
index 5126491b3861cdb60f23eec1b40b11466d27a33a..f207dc1c1b5c05c30089501551cdb0803fc33413 100644 |
--- a/base/threading/thread.h |
+++ b/base/threading/thread.h |
@@ -118,7 +118,7 @@ class BASE_EXPORT Thread : PlatformThread::Delegate { |
// Blocks until the thread starts running. Called within StartAndWait(). |
// Note that calling this causes jank on the calling thread, must be used |
// carefully for production code. |
- bool WaitUntilThreadStarted(); |
+ bool WaitUntilThreadStarted() const; |
// Signals the thread to exit and returns once the thread has exited. After |
// this method returns, the Thread object is completely reset and may be used |
@@ -170,7 +170,7 @@ class BASE_EXPORT Thread : PlatformThread::Delegate { |
// The native thread handle. |
PlatformThreadHandle thread_handle() { return thread_; } |
- // The thread ID. |
+ // The thread ID. Should be called after one of Start*() is called. |
PlatformThreadId thread_id() const; |
// Returns true if the thread has been started, and not yet stopped. |
@@ -212,15 +212,21 @@ class BASE_EXPORT Thread : PlatformThread::Delegate { |
// If true, we're in the middle of stopping, and shouldn't access |
// |message_loop_|. It may non-NULL and invalid. |
+ // Should be written on the thread that creates this thread. Also read data |
+ // could be wrong on other threads. |
bool stopping_; |
// True while inside of Run(). |
bool running_; |
- mutable base::Lock running_lock_; // Protects running_. |
+ |
+ // Protects |running_|. |
+ mutable base::Lock running_lock_; |
// The thread's handle. |
PlatformThreadHandle thread_; |
- mutable base::Lock thread_lock_; // Protects thread_. |
+ |
+ // The thread's id once it was started. Ensured by |start_event_|. |
+ PlatformThreadId id_; |
// The thread's message loop. Valid only while the thread is alive. Set |
// by the created thread. |