MCPcopy Create free account
hub / github.com/apache/arrow / OptionalParallelForAsync

Function OptionalParallelForAsync

cpp/src/arrow/util/parallel.h:88–101  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

86template <class FUNCTION, typename T,
87 typename R = typename internal::call_traits::return_type<FUNCTION>::ValueType>
88Future<std::vector<R>> OptionalParallelForAsync(
89 bool use_threads, std::vector<T> inputs, FUNCTION&& func,
90 Executor* executor = internal::GetCpuThreadPool(), TaskHints hints = TaskHints{}) {
91 if (use_threads) {
92 return ParallelForAsync(std::move(inputs), std::forward<FUNCTION>(func), executor,
93 hints);
94 } else {
95 std::vector<R> result(inputs.size());
96 for (size_t i = 0; i < inputs.size(); ++i) {
97 ARROW_ASSIGN_OR_RAISE(result[i], func(i, inputs[i]));
98 }
99 return result;
100 }
101}
102
103} // namespace internal
104} // namespace arrow

Callers 2

CopyFilesFunction · 0.85
DecodeRowGroupsMethod · 0.85

Calls 5

GetCpuThreadPoolFunction · 0.85
ParallelForAsyncFunction · 0.85
ARROW_ASSIGN_OR_RAISEFunction · 0.50
funcFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected