BOOST ASIO relation between I/O Service and a Socket and a Thread
Hi, By going through ASIO, i find that the I/O Service gets run on a thread and the socket gets created with a I/O Service. So the data for the socket has to be always sent through the same thread. For trying take advantage of data localization, i am exploring whether it would be possible to have a thread per multi-core processor running the io_service::run() method. I am just wondering there is a way where in i can change the io_service associated with the socket. Can someone help me with that? Thanks, Gokul.
By going through ASIO, i find that the I/O Service gets run on a thread and the socket gets created with a I/O Service. So the data for the socket has to be always sent through the same thread. For trying take advantage of data localization, i am exploring whether it would be possible to have a thread per multi-core processor running the io_service::run() method.
You can run io_service::run in several threads, like in "HTTP Server 3" example: http://www.boost.org/doc/libs/1_48_0/doc/html/boost_asio/examples.html
I am just wondering there is a way where in i can change the io_service associated with the socket.
No, you can't move a socket to another io_service.
participants (2)
-
Gokulakannan Somasundaram
-
Igor R