> I'm trying to write a simple ASIO send/receiver that uses message queueing. > The goal is to have a number of virtual streams over a single TCP connection. > This is pretty simple using callbacks, but I can't figure out the coroutines > alternative. Here is my simplified sample code. Note that I'm using > asio::experimental::promise the same way I would use std::promise which > obviously doesn't work, but it illustrates what I'm trying to do. What is the > simplest solution to my problem?
Have you considered utilizing asio::experimental::basic_channel? https://www.boost.org/doc/libs/1_84_0/doc/html/boost_asio/reference/experimental__basic_channel.html By the way, there is no synchronization mechanism in Asio akin to a future/promise pair, if you're open to external solutions, you might want to explore these options: https://github.com/ashtum/saf https://github.com/ashtum/oneshot Regards, Mohammad _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org https://lists.boost.org/mailman/listinfo.cgi/boost-users