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

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

Issue 7495031: trace_event support for thread names (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Tweaks to pass all trybots. Created 9 years, 4 months 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 67
68 // Gets the current thread id, which may be useful for logging purposes. 68 // Gets the current thread id, which may be useful for logging purposes.
69 static PlatformThreadId CurrentId(); 69 static PlatformThreadId CurrentId();
70 70
71 // Yield the current thread so another thread can be scheduled. 71 // Yield the current thread so another thread can be scheduled.
72 static void YieldCurrentThread(); 72 static void YieldCurrentThread();
73 73
74 // Sleeps for the specified duration (units are milliseconds). 74 // Sleeps for the specified duration (units are milliseconds).
75 static void Sleep(int duration_ms); 75 static void Sleep(int duration_ms);
76 76
77 // Sets the thread name visible to a debugger. This has no effect otherwise. 77 // Sets the thread name visible to debuggers/tools. This has no effect
78 // otherwise. This name pointer is not copied internally. Thus, it must stay
79 // valid until the thread ends.
78 static void SetName(const char* name); 80 static void SetName(const char* name);
79 81
82 // Gets the thread name, if previously set by SetName.
83 static const char* GetName();
84
80 // Creates a new thread. The |stack_size| parameter can be 0 to indicate 85 // Creates a new thread. The |stack_size| parameter can be 0 to indicate
81 // that the default stack size should be used. Upon success, 86 // that the default stack size should be used. Upon success,
82 // |*thread_handle| will be assigned a handle to the newly created thread, 87 // |*thread_handle| will be assigned a handle to the newly created thread,
83 // and |delegate|'s ThreadMain method will be executed on the newly created 88 // and |delegate|'s ThreadMain method will be executed on the newly created
84 // thread. 89 // thread.
85 // NOTE: When you are done with the thread handle, you must call Join to 90 // NOTE: When you are done with the thread handle, you must call Join to
86 // release system resources associated with the thread. You must ensure that 91 // release system resources associated with the thread. You must ensure that
87 // the Delegate object outlives the thread. 92 // the Delegate object outlives the thread.
88 static bool Create(size_t stack_size, Delegate* delegate, 93 static bool Create(size_t stack_size, Delegate* delegate,
89 PlatformThreadHandle* thread_handle); 94 PlatformThreadHandle* thread_handle);
(...skipping 11 matching lines...) Expand all
101 static void SetThreadPriority(PlatformThreadHandle handle, 106 static void SetThreadPriority(PlatformThreadHandle handle,
102 ThreadPriority priority); 107 ThreadPriority priority);
103 108
104 private: 109 private:
105 DISALLOW_IMPLICIT_CONSTRUCTORS(PlatformThread); 110 DISALLOW_IMPLICIT_CONSTRUCTORS(PlatformThread);
106 }; 111 };
107 112
108 } // namespace base 113 } // namespace base
109 114
110 #endif // BASE_THREADING_PLATFORM_THREAD_H_ 115 #endif // BASE_THREADING_PLATFORM_THREAD_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698