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 // The thread pool used in the POSIX implementation of WorkerPool dynamically | 5 // The thread pool used in the POSIX implementation of WorkerPool dynamically |
6 // adds threads as necessary to handle all tasks. It keeps old threads around | 6 // adds threads as necessary to handle all tasks. It keeps old threads around |
7 // for a period of time to allow them to be reused. After this waiting period, | 7 // for a period of time to allow them to be reused. After this waiting period, |
8 // the threads exit. This thread pool uses non-joinable threads, therefore | 8 // the threads exit. This thread pool uses non-joinable threads, therefore |
9 // worker threads are not joined during process shutdown. This means that | 9 // worker threads are not joined during process shutdown. This means that |
10 // potentially long running tasks (such as DNS lookup) do not block process | 10 // potentially long running tasks (such as DNS lookup) do not block process |
(...skipping 11 matching lines...) Expand all Loading... |
22 // These symbols are exported in a header purely for testing purposes. | 22 // These symbols are exported in a header purely for testing purposes. |
23 | 23 |
24 #ifndef BASE_THREADING_WORKER_POOL_POSIX_H_ | 24 #ifndef BASE_THREADING_WORKER_POOL_POSIX_H_ |
25 #define BASE_THREADING_WORKER_POOL_POSIX_H_ | 25 #define BASE_THREADING_WORKER_POOL_POSIX_H_ |
26 #pragma once | 26 #pragma once |
27 | 27 |
28 #include <queue> | 28 #include <queue> |
29 #include <string> | 29 #include <string> |
30 | 30 |
31 #include "base/basictypes.h" | 31 #include "base/basictypes.h" |
32 #include "base/callback.h" | 32 #include "base/callback_forward.h" |
33 #include "base/location.h" | 33 #include "base/location.h" |
34 #include "base/time.h" | 34 #include "base/time.h" |
35 #include "base/memory/ref_counted.h" | 35 #include "base/memory/ref_counted.h" |
36 #include "base/memory/scoped_ptr.h" | 36 #include "base/memory/scoped_ptr.h" |
37 #include "base/pending_task.h" | 37 #include "base/pending_task.h" |
38 #include "base/synchronization/condition_variable.h" | 38 #include "base/synchronization/condition_variable.h" |
39 #include "base/synchronization/lock.h" | 39 #include "base/synchronization/lock.h" |
40 #include "base/threading/platform_thread.h" | 40 #include "base/threading/platform_thread.h" |
41 #include "base/tracked_objects.h" | 41 #include "base/tracked_objects.h" |
42 | 42 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 // Only used for tests to ensure correct thread ordering. It will always be | 96 // Only used for tests to ensure correct thread ordering. It will always be |
97 // NULL in non-test code. | 97 // NULL in non-test code. |
98 scoped_ptr<ConditionVariable> num_idle_threads_cv_; | 98 scoped_ptr<ConditionVariable> num_idle_threads_cv_; |
99 | 99 |
100 DISALLOW_COPY_AND_ASSIGN(PosixDynamicThreadPool); | 100 DISALLOW_COPY_AND_ASSIGN(PosixDynamicThreadPool); |
101 }; | 101 }; |
102 | 102 |
103 } // namespace base | 103 } // namespace base |
104 | 104 |
105 #endif // BASE_THREADING_WORKER_POOL_POSIX_H_ | 105 #endif // BASE_THREADING_WORKER_POOL_POSIX_H_ |
OLD | NEW |