Asio io_service and Thread scheduler/executor
Hi, I am currently thinking about how to move our project at work from a set of specific threads (1 thread per module e.g.) and our own network library abstraction to Boost.Asio and Boost.Thread's scheduler/executors. Before I read about schedulers/executors I considered just using asio::io_service (with a pool of threads calling .run()) for quick-shot background offloading, but after looking at scheduler/executor I would prefer using it for background work. Does anybody have any experience how to combine boost::asio with boost::thread's scheduler/executors? In my preferred design I would only have one thread pool backing both asio work and background computational tasks (e.g. using boost::async(Executor&, F&&, ...) ) My initial gut feeling was to have a thread-pool calling boost::asio::io_service.run() and then wrap that in an executor. I guess what I am asking for if somebody has any previous experience to share with this or similar approaches. Kind regards, /M
Mikael Olenfalk wrote:
I am currently thinking about how to move our project at work from a set of specific threads (1 thread per module e.g.) and our own network library abstraction to Boost.Asio and Boost.Thread's scheduler/executors.
Before I read about schedulers/executors I considered just using asio::io_service (with a pool of threads calling .run()) for quick-shot background offloading, but after looking at scheduler/executor I would prefer using it for background work.
you might want to review the following: https://github.com/chriskohlhoff/executors
participants (2)
-
Arash Partow
-
Mikael Olenfalk