12 Feb
2009
12 Feb
'09
8:17 p.m.
On Thursday 12 February 2009 23:12:52 Igor R wrote:
If I use run there application hang, it doesn't use CPU and doesn't eat memory, just stop responce.
io_service::run() blocks until all the work is done. However, you can run io_service in another thread, like this: boost::thread thread(boost::bind(&io_service::run, &io_service_)); //note that io_service_ must outlive the thread
then you can use this io_service with any number of timers/sockets - all their handlers will run in that thread.
Thank you, this helps and I think I will use it for sockets as well.