How to wait for a thread to complete?
General and Desktop
4
Posts
4
Posters
4.3k
Views
1
Watching
-
In my main GUI thread, I start a new thread and need to wait until the thread is terminated normally. When waiting the thread, I do not want the main GUI thread loses the reponses, just like WaitForMultipleObjects in Windows SDK API. Is there a similar function that can implement this?
Thanks
-
Hi,
It depends on how you started the thread. What class did you use?
For QThread, listen for the QThread::finished() signal. The signal is emitted when the thread stops. Documentation at https://qt-project.org/doc/qt-5/qthread.html