
15 Sep
2010
15 Sep
'10
2:14 p.m.
Hi manuel,
You're right, the number of threads doesn't increase when I create more clients. Still, I'd like to know when these threads terminate. Do they nescessarily run until the app exits, or is there a way of telling asio 'hey, I'm done with sockets now, no need to keep these threads running'.
i think the threads are terminated when the destructor of the io_service is called. Creating threads is too expensive, to kill them everytime the program is idle. So they are usually left in a blocked state. You can try this by putting an iostream into brackets {} and set a breakpoint afterwards. If the threads are still running, they might be killed using an old C-technique, called atexit(). Regards, michi7x7