Create a group of operations that may be launched in parallel.
template< typename Range> ranged_parallel_group< decay_t< Range > > make_parallel_group( Range && range, constraint_t< is_async_operation_range< decay_t< Range > >::value > = 0);
A range containing the operations to be launched.
For example:
using op_type = decltype( socket1.async_read_some( asio::buffer(data1), asio::deferred ) ); std::vector<op_type> ops; ops.push_back( socket1.async_read_some( asio::buffer(data1), asio::deferred ) ); ops.push_back( socket2.async_read_some( asio::buffer(data2), asio::deferred ) ); asio::experimental::make_parallel_group(ops).async_wait( asio::experimental::wait_for_all(), []( std::vector<std::size_t> completion_order, std::vector<std::error_code> e, std::vector<std::size_t> n ) { for (std::size_t i = 0; i < completion_order.size(); ++i) { std::size_t idx = completion_order[i]; std::cout << "socket " << idx << " finished: "; std::cout << e[idx] << ", " << n[idx] << "\n"; } } );