Re: coroutine condition_variable
Richard Hodges via Boost-users <[email protected]> Wed, 6 Dec 2023 15:45:51 +0100
| Newsgroups | gmane.comp.lib.boost.user |
|---|---|
| Message-ID | <CALvx3hYyOdH=rbxK3Dw3OjLc0UNFebE6DV1M5jcy-_mLNPwdww@mail.gmail.com> |
> > > > 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://github.com/klemens-morgenstern/sam It contains an async condition variable fully compatible with asio 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 have been signalled". You can set the timer to expires_at(std::chrono::steady_clock::max()) to indicate that the wait should be indefinite. R _______________________________________________ Boost-users mailing list [email protected] https://lists.boost.org/mailman/listinfo.cgi/boost-users