Re: [Boost-users] coroutine condition_variable

2023-12-06 Thread Richard Hodges via Boost-users
On Wed, 6 Dec 2023 at 23:35, Keith Bennett via Boost-users < boost-users@lists.boost.org> wrote: > > > On Wed, Dec 6, 2023 at 9:20 AM Richard Hodges via Boost-users < > boost-users@lists.boost.org> wrote: > >> Anyway... you could create a `boost::asio::experimental::basic_channel` >>> using the si

Re: [Boost-users] coroutine condition_variable

2023-12-06 Thread Keith Bennett via Boost-users
On Wed, Dec 6, 2023 at 9:20 AM Richard Hodges via Boost-users < boost-users@lists.boost.org> wrote: > 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

Re: [Boost-users] coroutine condition_variable

2023-12-06 Thread Keith Bennett via Boost-users
On Wed, Dec 6, 2023 at 8:46 AM Richard Hodges via Boost-users < boost-users@lists.boost.org> wrote: > The other way is to use an asio steady_timer. You would cancel the timer > in order to signal the condition. The waiter would see this as an > *operation_aborted* error, which would indicate, "you

Re: [Boost-users] coroutine condition_variable

2023-12-06 Thread Richard Hodges via Boost-users
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

Re: [Boost-users] coroutine condition_variable

2023-12-06 Thread Vinnie Falco via Boost-users
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 punchl

Re: [Boost-users] coroutine condition_variable

2023-12-06 Thread Richard Hodges via Boost-users
> > > > One of the things that keeps cropping up in the ability to notify another > function that something has finished. In the past, I would use > condition_variable and wait on that. > > There are a couple of ways I have used to do this. Have a look at Klemens' experimental library https://githu

Re: [Boost-users] coroutine condition_variable

2023-12-06 Thread Keith Bennett via Boost-users
Hi Vinnie, I'd like to think that my question was legitimate and clear. "If only there was something like that" sounds snarky to me and doesn't answer the question at all. Maybe behind the scenes it might look like there's just another function to call when complete. But how do I go from *there*

Re: [Boost-users] coroutine condition_variable

2023-12-05 Thread Vinnie Falco via Boost-users
On Tue, Dec 5, 2023 at 5:43 PM Keith Bennett via Boost-users < boost-users@lists.boost.org> wrote: > One of the things that keeps cropping up in the ability to notify another > function that something has finished. > So... "call a function to indicate something has finished?" If only there was so