Stop all threads
I need to complete the work threads before closing the application. I have done so:
connect(quitAction, SIGNAL(triggered()), this, SLOT(quit()));
So it will be correct in terms of security? If not, please show how to correctly stop all threads.
It depends on what is going on in thread_update_base.
Your code does not look bad actually. You stop the event loop and then you politely wait.
However you need to ask yourself if your thread needs additional cleanup and if it is ok to stop the thread on termination of any method which happens to run when you call exit().
If you do not have an objection go ahead. Otherwise it is better to send a signal to the worker thread, pick the signal up, do the cleanup and then you exit().
You might consider using a maximum wait time.
If you have more than one thread to terminate, keep in mind that terminating one thread might trigger som event to be handled by another one...
To keep it simple, I would advise to keep a drawing of interaction, to know in which order terminate and when to wait. Definitely, not as easy as it sounds :-)
When the timer times out the Terminator enters the scene. Hasta la vista baby. The application may be severly hit. Continueing from here is dangerous and can lead to the land of pain.
Was that too dramatic?