Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 137 static PlatformThreadHandle CurrentHandle(); | 137 static PlatformThreadHandle CurrentHandle(); |
| 138 | 138 |
| 139 // Yield the current thread so another thread can be scheduled. | 139 // Yield the current thread so another thread can be scheduled. |
| 140 static void YieldCurrentThread(); | 140 static void YieldCurrentThread(); |
| 141 | 141 |
| 142 // Sleeps for the specified duration. | 142 // Sleeps for the specified duration. |
| 143 static void Sleep(base::TimeDelta duration); | 143 static void Sleep(base::TimeDelta duration); |
| 144 | 144 |
| 145 // Sets the thread name visible to debuggers/tools. This has no effect | 145 // Sets the thread name visible to debuggers/tools. This has no effect |
| 146 // otherwise. | 146 // otherwise. |
| 147 static void SetName(const std::string& name); | 147 static void SetName(const std::string& name, bool is_worker_thread = false); |
|
dcheng
2016/04/01 10:52:30
Plumbing this bit through a function called SetNam
| |
| 148 | 148 |
| 149 // Gets the thread name, if previously set by SetName. | 149 // Gets the thread name, if previously set by SetName. |
| 150 static const char* GetName(); | 150 static const char* GetName(); |
| 151 | 151 |
| 152 // Creates a new thread. The |stack_size| parameter can be 0 to indicate | 152 // Creates a new thread. The |stack_size| parameter can be 0 to indicate |
| 153 // that the default stack size should be used. Upon success, | 153 // that the default stack size should be used. Upon success, |
| 154 // |*thread_handle| will be assigned a handle to the newly created thread, | 154 // |*thread_handle| will be assigned a handle to the newly created thread, |
| 155 // and |delegate|'s ThreadMain method will be executed on the newly created | 155 // and |delegate|'s ThreadMain method will be executed on the newly created |
| 156 // thread. | 156 // thread. |
| 157 // NOTE: When you are done with the thread handle, you must call Join to | 157 // NOTE: When you are done with the thread handle, you must call Join to |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 191 | 191 |
| 192 static ThreadPriority GetCurrentThreadPriority(); | 192 static ThreadPriority GetCurrentThreadPriority(); |
| 193 | 193 |
| 194 private: | 194 private: |
| 195 DISALLOW_IMPLICIT_CONSTRUCTORS(PlatformThread); | 195 DISALLOW_IMPLICIT_CONSTRUCTORS(PlatformThread); |
| 196 }; | 196 }; |
| 197 | 197 |
| 198 } // namespace base | 198 } // namespace base |
| 199 | 199 |
| 200 #endif // BASE_THREADING_PLATFORM_THREAD_H_ | 200 #endif // BASE_THREADING_PLATFORM_THREAD_H_ |
| OLD | NEW |