On 10/25/05, Phil Endecott
Dear Experts,
The boost::thread documentation says: [...snip...] The actual application is a sort of daemon; a main loop accepts tcp connections, and creates a new thread to handle each one. It normally wants to "fire and forget" these threads, and I imagine it creating them with new() and then letting them dangle, until they eventually terminate and delete themselves.
I may be missing something here, but if thread lifetime and object lifetime are not tied, why not create the object on the stack (as part of an accept() loop, using the tcp connection example). The stack based object will be destroied each loop, but the thread itself will continue to exist until it ends. You could also use boost::call_once to "fire and forget"