Index: src/platform.h |
=================================================================== |
--- src/platform.h (revision 6139) |
+++ src/platform.h (working copy) |
@@ -387,6 +387,7 @@ |
// Create new thread. |
Thread(); |
+ explicit Thread(const char* name); |
virtual ~Thread(); |
// Start new thread by calling the Run() method in the new thread. |
@@ -395,6 +396,10 @@ |
// Wait until thread terminates. |
void Join(); |
+ inline const char* name() const { |
+ return name_; |
+ } |
+ |
// Abstract method for run handler. |
virtual void Run() = 0; |
@@ -417,8 +422,16 @@ |
static void YieldCPU(); |
private: |
+ void set_name(const char *name); |
+ |
class PlatformData; |
PlatformData* data_; |
+ |
+ // The thread name length is limited to 16 based on Linux's implementation of |
+ // prctl(). |
+ static const int kMaxThreadNameLength = 16; |
+ char name_[kMaxThreadNameLength]; |
+ |
DISALLOW_COPY_AND_ASSIGN(Thread); |
}; |