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

Function Submit

cpp/src/arrow/util/thread_pool.h:144–165  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

142 typename FutureType = typename ::arrow::detail::ContinueFuture::ForSignature<
143 Function && (Args && ...)>>
144 Result<FutureType> Submit(TaskHints hints, StopToken stop_token, Function&& func,
145 Args&&... args) {
146 using ValueType = typename FutureType::ValueType;
147
148 auto future = FutureType::Make();
149 auto task = std::bind(::arrow::detail::ContinueFuture{}, future,
150 std::forward<Function>(func), std::forward<Args>(args)...);
151 struct {
152 WeakFuture<ValueType> weak_fut;
153
154 void operator()(const Status& st) {
155 auto fut = weak_fut.get();
156 if (fut.is_valid()) {
157 fut.MarkFinished(st);
158 }
159 }
160 } stop_callback{WeakFuture<ValueType>(future)};
161 ARROW_RETURN_NOT_OK(SpawnReal(hints, std::move(task), std::move(stop_token),
162 std::move(stop_callback)));
163
164 return future;
165 }
166
167 template <typename Function, typename... Args,
168 typename FutureType = typename ::arrow::detail::ContinueFuture::ForSignature<

Callers

nothing calls this directly

Calls 3

SpawnRealFunction · 0.85
UnstoppableFunction · 0.85
MakeFunction · 0.70

Tested by

no test coverage detected