Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions include/exec/at_coroutine_exit.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,11 @@ namespace experimental::execution
template <__has_continuation _Promise>
auto await_suspend(__std::coroutine_handle<_Promise> __parent) -> bool
{
// Set the cleanup task's scheduler to the parent coroutine's scheduler.
__coro_.promise().__scheduler_ = get_start_scheduler(get_env(__parent.promise()));
// Set the cleanup task's scheduler to the parent coroutine's scheduler, if present
if constexpr (requires { get_start_scheduler(get_env(__parent.promise())); })
{
__coro_.promise().__scheduler_ = get_start_scheduler(get_env(__parent.promise()));
}
// This causes the parent to be resumed after the cleanup action is performed.
__coro_.promise().set_continuation(__parent.promise().continuation());
// This causes the parent to invoke the cleanup action when it performs the final
Expand Down
Loading