| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 probably be using Thread (thread.h) instead. Thread is | 5 // WARNING: You should probably be using Thread (thread.h) instead. Thread is |
| 6 // Chrome's message-loop based Thread abstraction, and if you are a | 6 // Chrome's message-loop based Thread abstraction, and if you are a |
| 7 // thread running in the browser, there will likely be assumptions | 7 // thread running in the browser, there will likely be assumptions |
| 8 // that your thread will have an associated message loop. | 8 // that your thread will have an associated message loop. |
| 9 // | 9 // |
| 10 // This is a simple thread interface that backs to a native operating system | 10 // This is a simple thread interface that backs to a native operating system |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 | 100 |
| 101 // Return True if Join() has evern been called. | 101 // Return True if Join() has evern been called. |
| 102 bool HasBeenJoined() { return joined_; } | 102 bool HasBeenJoined() { return joined_; } |
| 103 | 103 |
| 104 // Overridden from PlatformThread::Delegate: | 104 // Overridden from PlatformThread::Delegate: |
| 105 virtual void ThreadMain() OVERRIDE; | 105 virtual void ThreadMain() OVERRIDE; |
| 106 | 106 |
| 107 // Only set priorities with a careful understanding of the consequences. | 107 // Only set priorities with a careful understanding of the consequences. |
| 108 // This is meant for very limited use cases. | 108 // This is meant for very limited use cases. |
| 109 void SetThreadPriority(ThreadPriority priority) { | 109 void SetThreadPriority(ThreadPriority priority) { |
| 110 PlatformThread::SetThreadPriority(thread_, priority); | 110 PlatformThread::SetThreadPriority(thread_, tid(), priority); |
| 111 } | 111 } |
| 112 | 112 |
| 113 private: | 113 private: |
| 114 const std::string name_prefix_; | 114 const std::string name_prefix_; |
| 115 std::string name_; | 115 std::string name_; |
| 116 const Options options_; | 116 const Options options_; |
| 117 PlatformThreadHandle thread_; // PlatformThread handle, invalid after Join! | 117 PlatformThreadHandle thread_; // PlatformThread handle, invalid after Join! |
| 118 WaitableEvent event_; // Signaled if Start() was ever called. | 118 WaitableEvent event_; // Signaled if Start() was ever called. |
| 119 PlatformThreadId tid_; // The backing thread's id. | 119 PlatformThreadId tid_; // The backing thread's id. |
| 120 bool joined_; // True if Join has been called. | 120 bool joined_; // True if Join has been called. |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 int num_threads_; | 181 int num_threads_; |
| 182 std::vector<DelegateSimpleThread*> threads_; | 182 std::vector<DelegateSimpleThread*> threads_; |
| 183 std::queue<Delegate*> delegates_; | 183 std::queue<Delegate*> delegates_; |
| 184 base::Lock lock_; // Locks delegates_ | 184 base::Lock lock_; // Locks delegates_ |
| 185 WaitableEvent dry_; // Not signaled when there is no work to do. | 185 WaitableEvent dry_; // Not signaled when there is no work to do. |
| 186 }; | 186 }; |
| 187 | 187 |
| 188 } // namespace base | 188 } // namespace base |
| 189 | 189 |
| 190 #endif // BASE_THREADING_SIMPLE_THREAD_H_ | 190 #endif // BASE_THREADING_SIMPLE_THREAD_H_ |
| OLD | NEW |