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. This name pointer is not copied internally. Thus, it must stay | 159 // otherwise. |
160 // valid until the thread ends. | 160 static void SetName(const std::string& name); |
161 static void SetName(const char* name); | |
162 | 161 |
163 // Gets the thread name, if previously set by SetName. | 162 // Gets the thread name, if previously set by SetName. |
164 static const char* GetName(); | 163 static const char* GetName(); |
165 | 164 |
166 // Creates a new thread. The |stack_size| parameter can be 0 to indicate | 165 // Creates a new thread. The |stack_size| parameter can be 0 to indicate |
167 // that the default stack size should be used. Upon success, | 166 // that the default stack size should be used. Upon success, |
168 // |*thread_handle| will be assigned a handle to the newly created thread, | 167 // |*thread_handle| will be assigned a handle to the newly created thread, |
169 // and |delegate|'s ThreadMain method will be executed on the newly created | 168 // and |delegate|'s ThreadMain method will be executed on the newly created |
170 // thread. | 169 // thread. |
171 // NOTE: When you are done with the thread handle, you must call Join to | 170 // NOTE: When you are done with the thread handle, you must call Join to |
(...skipping 24 matching lines...) Expand all Loading... |
196 | 195 |
197 static ThreadPriority GetThreadPriority(PlatformThreadHandle handle); | 196 static ThreadPriority GetThreadPriority(PlatformThreadHandle handle); |
198 | 197 |
199 private: | 198 private: |
200 DISALLOW_IMPLICIT_CONSTRUCTORS(PlatformThread); | 199 DISALLOW_IMPLICIT_CONSTRUCTORS(PlatformThread); |
201 }; | 200 }; |
202 | 201 |
203 } // namespace base | 202 } // namespace base |
204 | 203 |
205 #endif // BASE_THREADING_PLATFORM_THREAD_H_ | 204 #endif // BASE_THREADING_PLATFORM_THREAD_H_ |
OLD | NEW |