Qt 6.11 is out! See what's new in the release
blog
Is QThread::exit() thread-safe?
General and Desktop
4
Posts
3
Posters
4.1k
Views
1
Watching
-
I understand that QThread::exec() must of course be called from QThread::run(). But is it safe to call exit() from another thread to stop event loop and therefore end default run() execution or exit() should also be called inside that thread only?
-
It would be safer to use signals and slots to handle this and have the thread itself call exit. You will retain the same functionality but will not have to be concerned on the thread context itself (i.e did you call exit from within a form, etc).