| 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 21 matching lines...) Expand all Loading... |
| 32 // thread.Start(); | 32 // thread.Start(); |
| 33 // // Start will return after the Thread has been successfully started and | 33 // // Start will return after the Thread has been successfully started and |
| 34 // // initialized. The newly created thread will invoke runner->Run(), and | 34 // // initialized. The newly created thread will invoke runner->Run(), and |
| 35 // // run until it returns. | 35 // // run until it returns. |
| 36 // thread.Join(); // Wait until the thread has exited. You *MUST* Join! | 36 // thread.Join(); // Wait until the thread has exited. You *MUST* Join! |
| 37 // // The SimpleThread object is still valid, however you may not call Join | 37 // // The SimpleThread object is still valid, however you may not call Join |
| 38 // // or Start again. | 38 // // or Start again. |
| 39 | 39 |
| 40 #ifndef BASE_THREADING_SIMPLE_THREAD_H_ | 40 #ifndef BASE_THREADING_SIMPLE_THREAD_H_ |
| 41 #define BASE_THREADING_SIMPLE_THREAD_H_ | 41 #define BASE_THREADING_SIMPLE_THREAD_H_ |
| 42 #pragma once | |
| 43 | 42 |
| 44 #include <string> | 43 #include <string> |
| 45 #include <queue> | 44 #include <queue> |
| 46 #include <vector> | 45 #include <vector> |
| 47 | 46 |
| 48 #include "base/base_export.h" | 47 #include "base/base_export.h" |
| 49 #include "base/basictypes.h" | 48 #include "base/basictypes.h" |
| 50 #include "base/compiler_specific.h" | 49 #include "base/compiler_specific.h" |
| 51 #include "base/threading/platform_thread.h" | 50 #include "base/threading/platform_thread.h" |
| 52 #include "base/synchronization/lock.h" | 51 #include "base/synchronization/lock.h" |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 int num_threads_; | 181 int num_threads_; |
| 183 std::vector<DelegateSimpleThread*> threads_; | 182 std::vector<DelegateSimpleThread*> threads_; |
| 184 std::queue<Delegate*> delegates_; | 183 std::queue<Delegate*> delegates_; |
| 185 base::Lock lock_; // Locks delegates_ | 184 base::Lock lock_; // Locks delegates_ |
| 186 WaitableEvent dry_; // Not signaled when there is no work to do. | 185 WaitableEvent dry_; // Not signaled when there is no work to do. |
| 187 }; | 186 }; |
| 188 | 187 |
| 189 } // namespace base | 188 } // namespace base |
| 190 | 189 |
| 191 #endif // BASE_THREADING_SIMPLE_THREAD_H_ | 190 #endif // BASE_THREADING_SIMPLE_THREAD_H_ |
| OLD | NEW |