POCOs HTTPTimeServer example has a sequence in the HTTPTimeServer::main() function that says:
HTTPServer srv(new TimeRequestHandlerFactory(), svs, pParams);
As I understand it, waitForTerminationRequest() waits for Ctrl-C or a kill signal. This would mean that the srv.stop() part of the function is never reached.
I'm looking for a way to wait for the server thread (started by srv.start() ) to finish and then continues with the execution, so I can cleanly shut down other stuff.
Do you have a suggestion ?
terminate() seems to just send a kill signal, and code beyond waitForTerminationRequest is never reached.
I have also tried to set a mutex in the constructor, then try to lock the mutex right before srv.stop() , which of course blocks. The idea was to release the lock as last action of the server thread. However, for reasons I do not understand, this does not work.
In any case thanks for your help!
Best Regards (and a good night),