| 205 | impl->queue.push(std::move(t)); |
| 206 | } |
| 207 | bool fifo_scheduler::try_run_one_task() |
| 208 | { |
| 209 | task_run_handle t; |
| 210 | { |
| 211 | std::lock_guard<std::mutex> locked(impl->lock); |
| 212 | t = impl->queue.pop(); |
| 213 | } |
| 214 | if (t) { |
| 215 | t.run(); |
| 216 | return true; |
| 217 | } |
| 218 | return false; |
| 219 | } |
| 220 | void fifo_scheduler::run_all_tasks() |
| 221 | { |
| 222 | while (try_run_one_task()) {} |