| 798 | } |
| 799 | |
| 800 | void operator()(const Result<Control>& maybe_control) && { |
| 801 | if (CheckForTermination(maybe_control)) return; |
| 802 | |
| 803 | auto control_fut = iterate(); |
| 804 | while (true) { |
| 805 | if (control_fut.TryAddCallback([this]() { return *this; })) { |
| 806 | // Adding a callback succeeded; control_fut was not finished |
| 807 | // and we must wait to CheckForTermination. |
| 808 | return; |
| 809 | } |
| 810 | // Adding a callback failed; control_fut was finished and we |
| 811 | // can CheckForTermination immediately. This also avoids recursion and potential |
| 812 | // stack overflow. |
| 813 | if (CheckForTermination(control_fut.result())) return; |
| 814 | |
| 815 | control_fut = iterate(); |
| 816 | } |
| 817 | } |
| 818 | |
| 819 | Iterate iterate; |
| 820 |
nothing calls this directly
no test coverage detected