6 Dec
2023
6 Dec
'23
2:45 p.m.
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