MCPcopy Create free account
hub / github.com/boostorg/asio / pipeline

Function pipeline

example/cpp14/executors/pipeline.cpp:159–174  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

157// Launch the last stage in a pipeline.
158template <class T, class F>
159std::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.
177template <class T, class F, class... Tail>

Callers 1

mainFunction · 0.70

Calls 6

get_associated_executorFunction · 0.85
get_futureMethod · 0.80
thread_executorClass · 0.70
requireFunction · 0.50
executeMethod · 0.45
stopMethod · 0.45

Tested by

no test coverage detected