* @brief Pop a task from the queue. * * @return The task. */
| 2249 | * @return The task. |
| 2250 | */ |
| 2251 | [[nodiscard]] task_t pop_task() |
| 2252 | { |
| 2253 | task_t task; |
| 2254 | if constexpr (priority_enabled) |
| 2255 | task = std::move(tasks.top().task); |
| 2256 | else |
| 2257 | task = std::move(tasks.front()); |
| 2258 | tasks.pop(); |
| 2259 | return task; |
| 2260 | } |
| 2261 | |
| 2262 | /** |
| 2263 | * @brief Reset the pool with a new number of threads and a new initialization function. This member function implements the actual reset, while the public member function `reset()` also handles the case where the pool is paused. |