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 10 matching lines...) Expand all Loading... |
21 #include "base/synchronization/lock.h" | 21 #include "base/synchronization/lock.h" |
22 #include "base/synchronization/waitable_event.h" | 22 #include "base/synchronization/waitable_event.h" |
23 #include "base/threading/platform_thread.h" | 23 #include "base/threading/platform_thread.h" |
24 #include "build/build_config.h" | 24 #include "build/build_config.h" |
25 | 25 |
26 namespace base { | 26 namespace base { |
27 | 27 |
28 class MessagePump; | 28 class MessagePump; |
29 class RunLoop; | 29 class RunLoop; |
30 | 30 |
| 31 // IMPORTANT: Instead of creating a base::Thread, consider using |
| 32 // base::Create(Sequenced|SingleTreaded)TaskRunnerWithTraits(). |
| 33 // |
31 // A simple thread abstraction that establishes a MessageLoop on a new thread. | 34 // A simple thread abstraction that establishes a MessageLoop on a new thread. |
32 // The consumer uses the MessageLoop of the thread to cause code to execute on | 35 // The consumer uses the MessageLoop of the thread to cause code to execute on |
33 // the thread. When this object is destroyed the thread is terminated. All | 36 // the thread. When this object is destroyed the thread is terminated. All |
34 // pending tasks queued on the thread's message loop will run to completion | 37 // pending tasks queued on the thread's message loop will run to completion |
35 // before the thread is terminated. | 38 // before the thread is terminated. |
36 // | 39 // |
37 // WARNING! SUBCLASSES MUST CALL Stop() IN THEIR DESTRUCTORS! See ~Thread(). | 40 // WARNING! SUBCLASSES MUST CALL Stop() IN THEIR DESTRUCTORS! See ~Thread(). |
38 // | 41 // |
39 // After the thread is stopped, the destruction sequence is: | 42 // After the thread is stopped, the destruction sequence is: |
40 // | 43 // |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 // This class is not thread-safe, use this to verify access from the owning | 335 // This class is not thread-safe, use this to verify access from the owning |
333 // sequence of the Thread. | 336 // sequence of the Thread. |
334 SequenceChecker owning_sequence_checker_; | 337 SequenceChecker owning_sequence_checker_; |
335 | 338 |
336 DISALLOW_COPY_AND_ASSIGN(Thread); | 339 DISALLOW_COPY_AND_ASSIGN(Thread); |
337 }; | 340 }; |
338 | 341 |
339 } // namespace base | 342 } // namespace base |
340 | 343 |
341 #endif // BASE_THREADING_THREAD_H_ | 344 #endif // BASE_THREADING_THREAD_H_ |
OLD | NEW |