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

Unified Diff: src/platform.h

Issue 6070009: Added labelled thread names to help with some debugging activity. Right now,... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years 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: src/platform.h
===================================================================
--- src/platform.h (revision 6114)
+++ src/platform.h (working copy)
@@ -387,6 +387,9 @@
// Create new thread.
Thread();
+#ifdef DEBUG_THREAD_NAMES
+ explicit Thread(const char* name);
+#endif
virtual ~Thread();
// Start new thread by calling the Run() method in the new thread.
@@ -395,6 +398,12 @@
// Wait until thread terminates.
void Join();
+#ifdef DEBUG_THREAD_NAMES
+ inline const char* Name() const {
Søren Thygesen Gjesse 2011/01/03 07:48:34 Please use all lower-case for this type of accesso
marklam 2011/01/04 01:47:09 Done.
+ return name_;
+ }
+#endif
+
// Abstract method for run handler.
virtual void Run() = 0;
@@ -417,8 +426,16 @@
static void YieldCPU();
private:
+#ifdef DEBUG_THREAD_NAMES
+ void SetName(const char *name);
Søren Thygesen Gjesse 2011/01/03 07:48:34 This setter should be called set_name, see http://
marklam 2011/01/04 01:47:09 Done.
+#endif
+
class PlatformData;
PlatformData* data_;
+#ifdef DEBUG_THREAD_NAMES
+ char name_[16];
Søren Thygesen Gjesse 2011/01/03 07:48:34 I think that this constant deserves a comment. E.g
marklam 2011/01/04 01:47:09 Done.
+#endif
+
DISALLOW_COPY_AND_ASSIGN(Thread);
};

Powered by Google App Engine
This is Rietveld 408576698