Empty the queue of tasks that may have been waiting to run.
| 94 | |
| 95 | // Empty the queue of tasks that may have been waiting to run. |
| 96 | PDAL_EXPORT void clearTasks() |
| 97 | { |
| 98 | // Effectively clear the queue. |
| 99 | std::lock_guard<std::mutex> lock(m_mutex); |
| 100 | std::queue<std::function<void()>> q; |
| 101 | m_tasks.swap(q); |
| 102 | } |
| 103 | |
| 104 | // Wait for all current tasks to complete. As opposed to join, tasks may |
| 105 | // continue to be added while a thread is await()-ing the queue to empty. |