| 208 | } |
| 209 | |
| 210 | int ThreadPoolExecutor::enqueue_task(Task&& task) noexcept { |
| 211 | if (is_running_in()) { |
| 212 | if (_local_capacity > 0) { |
| 213 | auto& local_queue = _local_task_queues.local(); |
| 214 | if (local_queue.size() < _local_capacity) { |
| 215 | local_queue.push<false, false, false>(::std::move(task)); |
| 216 | return 0; |
| 217 | } |
| 218 | } |
| 219 | } |
| 220 | _global_task_queue.push<true, false, true>(::std::move(task)); |
| 221 | return 0; |
| 222 | } |
| 223 | // ThreadPoolExecutor end |
| 224 | //////////////////////////////////////////////////////////////////////////////// |
| 225 | |