Boost logo

Boost Users :

Subject: Re: [Boost-users] ASIO Win32 Thread not terminated
From: michi7x7 (mailing-lists_at_[hidden])
Date: 2010-09-15 10:14:20


  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


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net