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

Function make_stop_callback

test/stdexec/algos/adaptors/test_stop_when.cpp:82–91  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

80
81 template <std::invocable Fn>
82 ex::sender auto make_stop_callback(Fn&& fn) noexcept
83 {
84 return ex::read_env(ex::get_stop_token)
85 | ex::then(
86 [fn = std::forward<Fn>(fn)](auto token) mutable noexcept
87 {
88 using cb_t = decltype(token)::template callback_type<std::remove_cvref_t<Fn>>;
89 return std::optional<cb_t>(std::in_place, std::move(token), std::move(fn));
90 });
91 }
92
93 TEST_CASE("callbacks registered with stop-when's token can be invoked", "[adaptors][stop-when]")
94 {

Callers 1

test_stop_when.cppFile · 0.85

Calls 1

thenFunction · 0.85

Tested by

no test coverage detected