| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 30 matching lines...) Expand all Loading... |
| 41 #define BASE_THREADING_SIMPLE_THREAD_H_ | 41 #define BASE_THREADING_SIMPLE_THREAD_H_ |
| 42 #pragma once | 42 #pragma once |
| 43 | 43 |
| 44 #include <string> | 44 #include <string> |
| 45 #include <queue> | 45 #include <queue> |
| 46 #include <vector> | 46 #include <vector> |
| 47 | 47 |
| 48 #include "base/basictypes.h" | 48 #include "base/basictypes.h" |
| 49 #include "base/lock.h" | 49 #include "base/lock.h" |
| 50 #include "base/threading/platform_thread.h" | 50 #include "base/threading/platform_thread.h" |
| 51 #include "base/waitable_event.h" | 51 #include "base/synchronization/waitable_event.h" |
| 52 | 52 |
| 53 namespace base { | 53 namespace base { |
| 54 | 54 |
| 55 // This is the base SimpleThread. You can derive from it and implement the | 55 // This is the base SimpleThread. You can derive from it and implement the |
| 56 // virtual Run method, or you can use the DelegateSimpleThread interface. | 56 // virtual Run method, or you can use the DelegateSimpleThread interface. |
| 57 class SimpleThread : public PlatformThread::Delegate { | 57 class SimpleThread : public PlatformThread::Delegate { |
| 58 public: | 58 public: |
| 59 class Options { | 59 class Options { |
| 60 public: | 60 public: |
| 61 Options() : stack_size_(0) { } | 61 Options() : stack_size_(0) { } |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 int num_threads_; | 173 int num_threads_; |
| 174 std::vector<DelegateSimpleThread*> threads_; | 174 std::vector<DelegateSimpleThread*> threads_; |
| 175 std::queue<Delegate*> delegates_; | 175 std::queue<Delegate*> delegates_; |
| 176 Lock lock_; // Locks delegates_ | 176 Lock lock_; // Locks delegates_ |
| 177 WaitableEvent dry_; // Not signaled when there is no work to do. | 177 WaitableEvent dry_; // Not signaled when there is no work to do. |
| 178 }; | 178 }; |
| 179 | 179 |
| 180 } // namespace base | 180 } // namespace base |
| 181 | 181 |
| 182 #endif // BASE_THREADING_SIMPLE_THREAD_H_ | 182 #endif // BASE_THREADING_SIMPLE_THREAD_H_ |
| OLD | NEW |