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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 // the current thread from another. | 149 // the current thread from another. |
150 static PlatformThreadHandle CurrentHandle(); | 150 static PlatformThreadHandle CurrentHandle(); |
151 | 151 |
152 // Yield the current thread so another thread can be scheduled. | 152 // Yield the current thread so another thread can be scheduled. |
153 static void YieldCurrentThread(); | 153 static void YieldCurrentThread(); |
154 | 154 |
155 // Sleeps for the specified duration. | 155 // Sleeps for the specified duration. |
156 static void Sleep(base::TimeDelta duration); | 156 static void Sleep(base::TimeDelta duration); |
157 | 157 |
158 // Sets the thread name visible to debuggers/tools. This has no effect | 158 // Sets the thread name visible to debuggers/tools. This has no effect |
159 // otherwise. | 159 // otherwise. This name pointer is not copied internally. Thus, it must stay |
160 static void SetName(const std::string& name); | 160 // valid until the thread ends. |
| 161 static void SetName(const char* name); |
161 | 162 |
162 // Gets the thread name, if previously set by SetName. | 163 // Gets the thread name, if previously set by SetName. |
163 static const char* GetName(); | 164 static const char* GetName(); |
164 | 165 |
165 // Creates a new thread. The |stack_size| parameter can be 0 to indicate | 166 // Creates a new thread. The |stack_size| parameter can be 0 to indicate |
166 // that the default stack size should be used. Upon success, | 167 // that the default stack size should be used. Upon success, |
167 // |*thread_handle| will be assigned a handle to the newly created thread, | 168 // |*thread_handle| will be assigned a handle to the newly created thread, |
168 // and |delegate|'s ThreadMain method will be executed on the newly created | 169 // and |delegate|'s ThreadMain method will be executed on the newly created |
169 // thread. | 170 // thread. |
170 // NOTE: When you are done with the thread handle, you must call Join to | 171 // NOTE: When you are done with the thread handle, you must call Join to |
(...skipping 24 matching lines...) Expand all Loading... |
195 | 196 |
196 static ThreadPriority GetThreadPriority(PlatformThreadHandle handle); | 197 static ThreadPriority GetThreadPriority(PlatformThreadHandle handle); |
197 | 198 |
198 private: | 199 private: |
199 DISALLOW_IMPLICIT_CONSTRUCTORS(PlatformThread); | 200 DISALLOW_IMPLICIT_CONSTRUCTORS(PlatformThread); |
200 }; | 201 }; |
201 | 202 |
202 } // namespace base | 203 } // namespace base |
203 | 204 |
204 #endif // BASE_THREADING_PLATFORM_THREAD_H_ | 205 #endif // BASE_THREADING_PLATFORM_THREAD_H_ |
OLD | NEW |