| 932 | |
| 933 | template <std::derived_from<task_base> Task> |
| 934 | void _static_thread_pool::bulk_enqueue(std::span<Task> tasks) noexcept |
| 935 | { |
| 936 | auto& queue = *this->get_remote_queue(); |
| 937 | for (std::uint32_t i = 0; i < tasks.size(); ++i) |
| 938 | { |
| 939 | std::uint32_t index = i % this->available_parallelism(); |
| 940 | queue.queues_[index].push_front(&tasks[i]); |
| 941 | thread_states_[index]->notify(); |
| 942 | } |
| 943 | // At this point the calling thread can exit and the pool will take over. |
| 944 | // Ultimately, the last completing thread passes the result forward. |
| 945 | // See `if (is_last_thread)` above. |
| 946 | } |
| 947 | |
| 948 | inline void _static_thread_pool::bulk_enqueue(remote_queue& queue, |
| 949 | __intrusive_queue<&task_base::next> tasks, |
no test coverage detected