On Wed, Dec 6, 2023 at 6:19 AM Keith Bennett via Boost-users <boost-users@lists.boost.org> wrote:
"If only there was something like that" sounds snarky to me and doesn't answer the question at all.

You are right about that but honestly it is irresistible for me to go for the obvious punchline :)

For those that don't know, I am referring to "callbacks."

 I want to straight adapt it into coroutines as much as possible.

Conditional variables are an anti-pattern in asynchronous code, because the wait state ties up the calling thread.

Anyway... you could create a `boost::asio::experimental::basic_channel` using the signature `(void)` and then `co_await` the channel to suspend the coroutine. Later when you want to wake it up, send a message to the channel from elsewhere. You will need to be thoughtful about the order of how things are destroyed if you want to tear down the socket (or corresponding I/O object). More here:

https://www.boost.org/doc/libs/1_83_0/doc/html/boost_asio/reference/experimental__basic_channel.html

Thanks