Skip to content

make as_awaitable savvy to senders that are known to complete inline#1901

Merged
ericniebler merged 4 commits intoNVIDIA:mainfrom
ericniebler:co-await-inline-senders-does-not-recurse
Feb 27, 2026
Merged

make as_awaitable savvy to senders that are known to complete inline#1901
ericniebler merged 4 commits intoNVIDIA:mainfrom
ericniebler:co-await-inline-senders-does-not-recurse

Conversation

@ericniebler
Copy link
Collaborator

awaiting a coroutine such as:

  auto burn_cycles() -> ex::task<int>
  {
    int result = 42;
    for (int i = 0; i < 1'000'000; ++i)
    {
      result += co_await ex::just(42);
    }
    co_return result;
  }

will no longer cause a stack overflow. for this optimization to kick in, the sender being co_await-ed must be known statically to complete inline always, but never complete with set_stopped.

@ericniebler ericniebler force-pushed the co-await-inline-senders-does-not-recurse branch from 6346851 to 2a49573 Compare February 26, 2026 23:56
@ericniebler ericniebler merged commit df2ce08 into NVIDIA:main Feb 27, 2026
26 checks passed
@ericniebler ericniebler deleted the co-await-inline-senders-does-not-recurse branch February 27, 2026 03:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant