Re: [asio-users] boost-asio and asio coexistance
Brought to you by:
chris_kohlhoff
|
From: Vinnie F. <vin...@gm...> - 2024-02-09 23:15:55
|
On Fri, Feb 9, 2024 at 2:51 PM <mat...@gm...> wrote:
> I guess my question is about best practices for running both asio versions
> in the same application, in other words handling both io_context::run()?
>
Well if you want to call `io_context::run()` you will need a separate
thread for each. I suspect this is not what you want, so instead you might
write:
while( is_running() ) // your function
{
ctx0.run_for( std::chrono::milliseconds(50) );
ctx1.run_for( std::chrono::milliseconds(50) );
}
You will need to figure out what works best for your application in terms
of dividing the time between the contexts.
Thanks
|