dispenso 1.4.1
A library for task parallelism
Loading...
Searching...
No Matches
pipeline.h
Go to the documentation of this file.
1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 */
7
14#pragma once
15
16#include <limits>
17
18#include <dispenso/detail/pipeline_impl.h>
19
20namespace dispenso {
21
29template <typename T>
30using OpResult = detail::OpResult<T>;
31
36constexpr ssize_t kStageNoLimit = std::numeric_limits<ssize_t>::max();
37
48template <typename F>
49auto stage(F&& f, ssize_t limit) {
50 return detail::Stage<F>(std::forward<F>(f), limit);
51}
52
77template <typename... Stages>
78void pipeline(ThreadPool& pool, Stages&&... sIn) {
79 ConcurrentTaskSet tasks(pool);
80 auto pipes = detail::makePipes(tasks, std::forward<Stages>(sIn)...);
81 pipes.execute();
82 pipes.wait();
83}
84
108template <typename... Stages>
109void pipeline(Stages&&... sIn) {
110 pipeline(globalThreadPool(), std::forward<Stages>(sIn)...);
111}
112
113} // namespace dispenso
auto stage(F &&f, ssize_t limit)
Definition pipeline.h:49
void pipeline(ThreadPool &pool, Stages &&... sIn)
Definition pipeline.h:78
constexpr ssize_t kStageNoLimit
Definition pipeline.h:36
detail::OpResult< T > OpResult
Optional-like storage with in-place construction (C++14 compatible).
Definition pipeline.h:30