Hi,
I’m writing a small network event server for my application; the project is based on threads.
Each connection to a client is served by a thread which the main task generates after Accept:
while (1) {
TSocket *s = lsocket->Accept ();
TThread *thread = new TThread ("es_handler", es_handler::run_thread, s);
thread->Run ();
}
Since the main task is not interested on the future of the childs I would like to detach the thread. Unfortunatelly the root interface does not export a method to detach, even if the fDetached variable exists.
A secon problem regards the TThred istance itself: the main task will not use the pointer to childs, then to avoid memory leaks I would delete them, but this is not valid (since childs are running). Any idea?
PS: the same leak problem came form the s pointer which cannot be deleted by the main task.