| 157 | // Launch the last stage in a pipeline. |
| 158 | template <class T, class F> |
| 159 | std::future<void> pipeline(queue_back<T> in, F f) |
| 160 | { |
| 161 | // Get the function's associated executor, defaulting to thread_executor. |
| 162 | auto ex = get_associated_executor(f, thread_executor()); |
| 163 | |
| 164 | // Run the function, and as we're the last stage return a future so that the |
| 165 | // caller can wait for the pipeline to finish. |
| 166 | std::packaged_task<void()> task( |
| 167 | [in, f = std::move(f)]() mutable |
| 168 | { |
| 169 | f(in); |
| 170 | }); |
| 171 | std::future<void> fut = task.get_future(); |
| 172 | boost::asio::require(ex, execution::blocking.never).execute(std::move(task)); |
| 173 | return fut; |
| 174 | } |
| 175 | |
| 176 | // Launch an intermediate stage in a pipeline. |
| 177 | template <class T, class F, class... Tail> |
no test coverage detected