Skip to content

Commit

Permalink
spawn clears the cancellation_slot.
Browse files Browse the repository at this point in the history
  • Loading branch information
klemens-morgenstern committed Sep 19, 2024
1 parent d68d7d4 commit 7f8c3f4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion include/boost/cobalt/detail/spawn.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,12 @@ struct async_initiate_spawn

decltype(recs) r;
Handler handler;
asio::cancellation_slot sl;

void operator()()
{
if (sl.is_connected())
sl.clear();
auto ex = r->exception;
T rr{};
if (r->result)
Expand All @@ -88,7 +91,7 @@ struct async_initiate_spawn

p->awaited_from.reset(detail::post_coroutine(
completion_handler{
alloc, asio::get_associated_executor(h, exec), std::move(recs), std::move(h)
alloc, asio::get_associated_executor(h, exec), std::move(recs), std::move(h), sl
}).address());

asio::dispatch(exec, std::coroutine_handle<detail::task_promise<T>>::from_promise(*p->promise));
Expand Down

0 comments on commit 7f8c3f4

Please sign in to comment.