2017-01-21 20:09 GMT+08:00 Adam Zegelin <adam@zegelin.com>:
Hi,

I'm writing a boost::asio application that communicates with multiple
streams. I'd like to write data to these streams then wait for
everyone to reply before performing computation on the resulting data.

What is the best way to implement this?

The route I've ventured down involves me calling async_write() on each
stream, with the callback hander executing async_read(). But this
where I'm stuck. What is the best way to execute one final hander once
all read operations have completed?

Coroutine may help. Take a simple echo-server for example: https://github.com/jamboree/co2#asio-echo-server
In your case, you just need to keep the tasks in a list and 'await' for them to complete.