Hello, I've already wasted two days reading documentation of boost::asio And I still don't know how could I implement blocking select() like function for several sockets using only one thread (using boost framework). Asynchronous functions of boost::asio returns immediately, so there would be a need to put some wait function in main thread untill one of the async_read's finishes. I suspect that this would time consuming, but I'm really restricted by performace requirements.
-
The
io_service
object is an abstraction of theselect
function. Set up your sockets and then call theio_service::run
member function from your main thread. Theio_service::run
function will block until all of the work associated with theio_service
instance is completed. You can schedule more work in your asynchronous handlers.You can also use
io_service::run_one
,io_service::poll
, orio_service::poll_one
in place ofio_service::run
.From Dan
0 comments:
Post a Comment