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 #include "base/threading/worker_pool_posix.h" | 5 #include "base/threading/worker_pool_posix.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
119 g_lazy_worker_pool.Pointer()->PostTask(from_here, std::move(task), | 119 g_lazy_worker_pool.Pointer()->PostTask(from_here, std::move(task), |
120 task_is_slow); | 120 task_is_slow); |
121 return true; | 121 return true; |
122 } | 122 } |
123 | 123 |
124 // static | 124 // static |
125 bool WorkerPool::RunsTasksOnCurrentThread() { | 125 bool WorkerPool::RunsTasksOnCurrentThread() { |
126 return g_worker_pool_running_on_this_thread.Get().Get(); | 126 return g_worker_pool_running_on_this_thread.Get().Get(); |
127 } | 127 } |
128 | 128 |
129 bool WorkerPool::RunsTasksInCurrentSequence() { | |
gab
2017/04/18 15:00:33
// static
above.
| |
130 return g_worker_pool_running_on_this_thread.Get().Get(); | |
131 } | |
132 | |
129 PosixDynamicThreadPool::PosixDynamicThreadPool(const std::string& name_prefix, | 133 PosixDynamicThreadPool::PosixDynamicThreadPool(const std::string& name_prefix, |
130 int idle_seconds_before_exit) | 134 int idle_seconds_before_exit) |
131 : name_prefix_(name_prefix), | 135 : name_prefix_(name_prefix), |
132 idle_seconds_before_exit_(idle_seconds_before_exit), | 136 idle_seconds_before_exit_(idle_seconds_before_exit), |
133 pending_tasks_available_cv_(&lock_), | 137 pending_tasks_available_cv_(&lock_), |
134 num_idle_threads_(0) {} | 138 num_idle_threads_(0) {} |
135 | 139 |
136 PosixDynamicThreadPool::~PosixDynamicThreadPool() { | 140 PosixDynamicThreadPool::~PosixDynamicThreadPool() { |
137 while (!pending_tasks_.empty()) | 141 while (!pending_tasks_.empty()) |
138 pending_tasks_.pop(); | 142 pending_tasks_.pop(); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
181 return PendingTask(FROM_HERE, base::Closure()); | 185 return PendingTask(FROM_HERE, base::Closure()); |
182 } | 186 } |
183 } | 187 } |
184 | 188 |
185 PendingTask pending_task = std::move(pending_tasks_.front()); | 189 PendingTask pending_task = std::move(pending_tasks_.front()); |
186 pending_tasks_.pop(); | 190 pending_tasks_.pop(); |
187 return pending_task; | 191 return pending_task; |
188 } | 192 } |
189 | 193 |
190 } // namespace base | 194 } // namespace base |
OLD | NEW |