Re: [asio-users] boost-asio and asio coexistance
Brought to you by:
chris_kohlhoff
From: <mat...@gm...> - 2024-02-12 16:11:31
|
Thanks Vinnie, I have considered that and unfortunately its not going to work for this application. I think I will need to backport some of the lib2 code. The biggest pieces I see are the newer code uses any_io_executor which if I'm understanding it, could be changed to use the older executor wrapper. Then there is the use of async_initiate. This one is not as clear to me but I think I can change it to async_result but need to look into it more. Thanks, Matt. On Fri, Feb 9, 2024 at 6:16 PM Vinnie Falco <vin...@gm...> wrote: > 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 > > > _______________________________________________ > asio-users mailing list > asi...@li... > https://lists.sourceforge.net/lists/listinfo/asio-users > _______________________________________________ > Using Asio? List your project at > http://think-async.com/Asio/WhoIsUsingAsio > |