Ive got a server that uses boost::asiowhich I want to do multithreaded.
The server can be divided into several "areas", with sockets starting in the connection area, and then after connecting to a client that moves to the authentication area (that is, login or register), before moving between various other parts of the server, it depends on what makes the client.
I don’t want to just use the thread pool in one io_servicefor all sockets, as a large number of locks will be required, especially in areas with a lot of interaction with shared resources. However, instead, I want to provide each server component (e.g. authentication) with its own thread.
However, I am not sure how to do this. I considered the idea of giving each component its own io_service so that it could use whatever streams it wanted, however the socket area is tied to io_service, and I'm not sure how then to move the client socket from one component to another.
source
share