On Fri, Jan 8, 2010 at 4:41 PM, Lloyd
<lloyd@cdactvm.in> wrote:
This is the way I create new thread
void TCPConnection::MyFunction()
{
....
boost::thread *th=new boost::thread(boost::bind(&TCPConnection::ExecutionRoutine,shared_from_this(),Command));
...
}
when the ExecutionRoutine() finishes its execution, naturally the destructor of the TCPConnection class has to be called. But it never gets called! But if call a join from someware else (th->join()) the destructor of the TCPConnection class gets called and the connection is terminated, otherwise the it continues in the connected state!!
What could be the mistake I am doing?
If not mistaken that's the normal behavior which requires parent thread to join() its child threads, for proper release of thread resources, and I don't think it is specific to Boost.Thread. I might be wrong though.
Thanks,
Lloyd
___________________
Happy New Year 2010