dispenso
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
13#pragma once
14
15#include <limits>
16
17#include <dispenso/detail/pipeline_impl.h>
18
19namespace dispenso {
20
28template <typename T>
29using OpResult = detail::OpResult<T>;
30
35constexpr ssize_t kStageNoLimit = std::numeric_limits<ssize_t>::max();
36
47template <typename F>
48auto stage(F&& f, ssize_t limit) {
49 return detail::Stage<F>(std::forward<F>(f), limit);
50}
51
76template <typename... Stages>
79 auto pipes = detail::makePipes(tasks, std::forward<Stages>(sIn)...);
80 pipes.execute();
81 pipes.wait();
82}
83
107template <typename... Stages>
108void pipeline(Stages&&... sIn) {
109 pipeline(globalThreadPool(), std::forward<Stages>(sIn)...);
110}
111
112} // namespace dispenso
auto stage(F &&f, ssize_t limit)
Definition pipeline.h:48
void pipeline(ThreadPool &pool, Stages &&... sIn)
Definition pipeline.h:77
constexpr ssize_t kStageNoLimit
Definition pipeline.h:35
detail::OpResult< T > OpResult
Definition pipeline.h:29