MCPcopy Create free account
hub / github.com/NVIDIA/stdexec / async_throw_from_completion

Function async_throw_from_completion

test/exec/asio/test_completion_token.cpp:229–242  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

227
228 template <typename Executor, typename CompletionToken>
229 decltype(auto) async_throw_from_completion(Executor const & ex, CompletionToken&& token)
230 {
231 using signature_type = void();
232 return asio_impl::async_initiate<CompletionToken, signature_type>(
233 [ex](auto h)
234 {
235 auto const assoc = asio_impl::get_associated_executor(h, ex);
236 asio_impl::post(ex,
237 asio_impl::bind_executor(assoc,
238 [h = std::move(h)]()
239 { throw std::logic_error("Test"); }));
240 },
241 token);
242 }
243
244 TEST_CASE("When a completion handler invoked as part of a composed "
245 "asynchronous operation throws that exception is captured and sent as a "

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected