Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QEventLoop created in 1 thread, exec in another one and exit in the first thread
2beers last edited by
Hi everyone. I'm trying to understand how QEventLoop is working.
I have one application that uses 2 threads. I create a QEventLoop in 1 thread , start the loop(exec) in the second thread, and stop(exit) it the first thread.
It shows me that the loop has been stoped, but in reallity id didn't.
Now if I create The QEventLoop in the same thread as it starts(exec) and stop it from the other thread works great.
I'm interested why is happening this? why was my first example wrong, and why is the second example working?
andre last edited by
AFAIK: An eventloop is designed to be used by only one thread. There is no telling what happens if you start messing with one from different threads. Simply don't do that.