
Igor R wrote:
However, I'm not sure whether to choose of poll_one or run_one in this case. I.e., I'm looking for the cheapest "do some other stuff" of asio's io_service.
run_once() is ok here, but anyway your loop will *block* any further iterations until result_available == true, won't it? If so, why not just use synchronous asio functions? Actually, they are already implemented in the very similar way to what you're trying to do.
Thanks. I'm aware of asio's synchronous operation support. However, the application in question implements a producer/consumer pattern, with potentially many blocking consumers at the same time in the same application. Other work should be done while "blocking", to keep as many threads as possible going. Why is run_one better than poll_one in this case? Thanks, Kind regards, Rutger