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

Side by Side Diff: base/threading/platform_thread.h

Issue 11438022: Add ability to retrieve a thread_name given a thread_id. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Store a version number for the current name for fast comparisons. Created 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // WARNING: You should *NOT* be using this class directly. PlatformThread is 5 // WARNING: You should *NOT* be using this class directly. PlatformThread is
6 // the low-level platform-specific abstraction to the OS's threading interface. 6 // the low-level platform-specific abstraction to the OS's threading interface.
7 // You should instead be using a message-loop driven Thread, see thread.h. 7 // You should instead be using a message-loop driven Thread, see thread.h.
8 8
9 #ifndef BASE_THREADING_PLATFORM_THREAD_H_ 9 #ifndef BASE_THREADING_PLATFORM_THREAD_H_
10 #define BASE_THREADING_PLATFORM_THREAD_H_ 10 #define BASE_THREADING_PLATFORM_THREAD_H_
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 static void Sleep(base::TimeDelta duration); 69 static void Sleep(base::TimeDelta duration);
70 70
71 // Sets the thread name visible to debuggers/tools. This has no effect 71 // Sets the thread name visible to debuggers/tools. This has no effect
72 // otherwise. This name pointer is not copied internally. Thus, it must stay 72 // otherwise. This name pointer is not copied internally. Thus, it must stay
73 // valid until the thread ends. 73 // valid until the thread ends.
74 static void SetName(const char* name); 74 static void SetName(const char* name);
75 75
76 // Gets the thread name, if previously set by SetName. 76 // Gets the thread name, if previously set by SetName.
77 static const char* GetName(); 77 static const char* GetName();
78 78
79 // Gets the version number for the thread name.
80 static uint32 GetVersionForName();
81
79 // Creates a new thread. The |stack_size| parameter can be 0 to indicate 82 // Creates a new thread. The |stack_size| parameter can be 0 to indicate
80 // that the default stack size should be used. Upon success, 83 // that the default stack size should be used. Upon success,
81 // |*thread_handle| will be assigned a handle to the newly created thread, 84 // |*thread_handle| will be assigned a handle to the newly created thread,
82 // and |delegate|'s ThreadMain method will be executed on the newly created 85 // and |delegate|'s ThreadMain method will be executed on the newly created
83 // thread. 86 // thread.
84 // NOTE: When you are done with the thread handle, you must call Join to 87 // NOTE: When you are done with the thread handle, you must call Join to
85 // release system resources associated with the thread. You must ensure that 88 // release system resources associated with the thread. You must ensure that
86 // the Delegate object outlives the thread. 89 // the Delegate object outlives the thread.
87 static bool Create(size_t stack_size, Delegate* delegate, 90 static bool Create(size_t stack_size, Delegate* delegate,
88 PlatformThreadHandle* thread_handle); 91 PlatformThreadHandle* thread_handle);
(...skipping 22 matching lines...) Expand all
111 static void SetThreadPriority(PlatformThreadHandle handle, 114 static void SetThreadPriority(PlatformThreadHandle handle,
112 ThreadPriority priority); 115 ThreadPriority priority);
113 116
114 private: 117 private:
115 DISALLOW_IMPLICIT_CONSTRUCTORS(PlatformThread); 118 DISALLOW_IMPLICIT_CONSTRUCTORS(PlatformThread);
116 }; 119 };
117 120
118 } // namespace base 121 } // namespace base
119 122
120 #endif // BASE_THREADING_PLATFORM_THREAD_H_ 123 #endif // BASE_THREADING_PLATFORM_THREAD_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698