I was just going over the asio example here: http://www.boost.org/doc/libs/1%5F39%5F0/doc/html/boost%5Fasio/example/chat/chat%5Fserver.cpp My question is about their usage of the io_serice.run() function. The documentation for the io_service.run() function says:
"The run() function blocks until all work has finished and there are no more handlers to be dispatched, or until the io_service has been stopped. Multiple threads may call the run() function to set up a pool of threads from which the io_service may execute handlers. All threads that are waiting in the pool are equivalent and the io_service may choose any one of them to invoke a handler. The run() function may be safely called again once it has completed only after a call to reset()."
It says that the run function will return, and I'm assuming that when it does return the network thread stops until it is called again. If that is true, then why isn't the run function called in a loop, or at least given its own thread? the io_service.run() function is pretty much a mystery to me.