cplusplus / sender-receiver

Issues list for P2300
Apache License 2.0
19 stars 3 forks source link

Define a policy for resuming leaf operations that avoids running continuations inline on context that triggered completion #269

Open lewissbaker opened 3 months ago

lewissbaker commented 3 months ago

There are several data-structures that have async operations where a consumer that waits on something is un-blocked by some other operation on the data-structure.

For example:

These are just two examples of this kind of "something happens that triggers completion of some waiting operation" situation - this situation will recur on almost all data-structures that have a "wait until something happens" async operation.

We need to come up with a strategy/pattern that we can apply to such data-structures to ensure that they have consistent behaviour that doesn't have the inline-completion footguns.

Several options to consider:

Note that this may tie in with the task design - the task coroutine type may implicitly apply such an algorithm to all co_await expressions within the coroutine.