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 #ifndef BASE_THREADING_THREAD_H_ | 5 #ifndef BASE_THREADING_THREAD_H_ |
6 #define BASE_THREADING_THREAD_H_ | 6 #define BASE_THREADING_THREAD_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
238 | 238 |
239 // Returns the thread ID. Should not be called before the first Start*() | 239 // Returns the thread ID. Should not be called before the first Start*() |
240 // call. Keeps on returning the same ID even after a Stop() call. The next | 240 // call. Keeps on returning the same ID even after a Stop() call. The next |
241 // Start*() call renews the ID. | 241 // Start*() call renews the ID. |
242 // | 242 // |
243 // WARNING: This function will block if the thread hasn't started yet. | 243 // WARNING: This function will block if the thread hasn't started yet. |
244 // | 244 // |
245 // This method is thread-safe. | 245 // This method is thread-safe. |
246 PlatformThreadId GetThreadId() const; | 246 PlatformThreadId GetThreadId() const; |
247 | 247 |
248 // Returns the current thread handle. If called before Start*() returns or | |
249 // after Stop() returns, an empty thread handle will be returned. | |
250 // | |
251 // This method is thread-safe. | |
gab
2017/05/04 18:11:58
TODO(robliao): remove this when it no longer needs
robliao
2017/05/04 19:01:49
Done.
| |
252 PlatformThreadHandle GetThreadHandle() const; | |
253 | |
248 // Returns true if the thread has been started, and not yet stopped. | 254 // Returns true if the thread has been started, and not yet stopped. |
249 bool IsRunning() const; | 255 bool IsRunning() const; |
250 | 256 |
251 protected: | 257 protected: |
252 // Called just prior to starting the message loop | 258 // Called just prior to starting the message loop |
253 virtual void Init() {} | 259 virtual void Init() {} |
254 | 260 |
255 // Called to start the run loop | 261 // Called to start the run loop |
256 virtual void Run(RunLoop* run_loop); | 262 virtual void Run(RunLoop* run_loop); |
257 | 263 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
335 // This class is not thread-safe, use this to verify access from the owning | 341 // This class is not thread-safe, use this to verify access from the owning |
336 // sequence of the Thread. | 342 // sequence of the Thread. |
337 SequenceChecker owning_sequence_checker_; | 343 SequenceChecker owning_sequence_checker_; |
338 | 344 |
339 DISALLOW_COPY_AND_ASSIGN(Thread); | 345 DISALLOW_COPY_AND_ASSIGN(Thread); |
340 }; | 346 }; |
341 | 347 |
342 } // namespace base | 348 } // namespace base |
343 | 349 |
344 #endif // BASE_THREADING_THREAD_H_ | 350 #endif // BASE_THREADING_THREAD_H_ |
OLD | NEW |