Index: base/threading/thread.cc |
=================================================================== |
--- base/threading/thread.cc (revision 138018) |
+++ base/threading/thread.cc (working copy) |
@@ -47,6 +47,7 @@ |
Thread::Thread(const char* name) |
: started_(false), |
stopping_(false), |
+ running_(false), |
startup_data_(NULL), |
thread_(0), |
message_loop_(NULL), |
@@ -124,6 +125,10 @@ |
message_loop_->PostTask(FROM_HERE, base::Bind(&ThreadQuitHelper)); |
} |
+bool Thread::IsRunning() const { |
+ return running_; |
+} |
+ |
void Thread::Run(MessageLoop* message_loop) { |
message_loop->Run(); |
} |
@@ -160,7 +165,9 @@ |
// startup_data_ can't be touched anymore since the starting thread is now |
// unlocked. |
+ running_ = true; |
Run(message_loop_); |
+ running_ = false; |
// Let the thread do extra cleanup. |
CleanUp(); |
@@ -171,7 +178,6 @@ |
// We can't receive messages anymore. |
message_loop_ = NULL; |
} |
- thread_id_ = kInvalidThreadId; |
} |
} // namespace base |