If this is the last task group then start the next stage
| 75 | Status FastTaskImpl(std::size_t, int64_t) { return Status::OK(); } |
| 76 | // If this is the last task group then start the next stage |
| 77 | TaskScheduler::TaskGroupContinuationImpl MakeContinuation( |
| 78 | std::atomic<int>* counter, std::function<void(std::size_t, int)> start_next_stage, |
| 79 | int next_stage) { |
| 80 | return [counter, start_next_stage, next_stage](std::size_t thread_id) { |
| 81 | if (counter->fetch_sub(1) == 1) { |
| 82 | start_next_stage(thread_id, next_stage); |
| 83 | } |
| 84 | return Status::OK(); |
| 85 | }; |
| 86 | } |
| 87 | // Signal the cv if this is the last group |
| 88 | TaskScheduler::TaskGroupContinuationImpl MakeFinalContinuation( |
| 89 | std::atomic<int>* counter, std::mutex* mutex, std::condition_variable* finish) { |