Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Qt::BlockingQueuedConnection blocks worker thread indefinitely if I close application
moldovan.catalin last edited by
I have an application on N900 that has two threads, the UI thread and a worker thread. In the UI thread I connect a signal from the worker thread with a slot from the UI using Qt::BlockingQueuedConnection (I need this because I cannot create QPixmap in other thread than UI thread) and it works great until I close the application, when sometimes the worker thread doesn't die. I found the problem to be related to this blocking connection, it seems that when the UI dies the semaphore or mutex that is used to block the worker thread is not unlocked in the UI thread and worker thread hangs forever.
Does anyone have any suggestion how could I prevent this? (Please don't tell me to stop using Qt::BlockingQueuedConnection, that's not an answer).
tony last edited by
well, I don't know if I've understood your problem clearly, but ...
can you set a worker thread internal flag that means "it's time to get out", and send a "fake" signal to the worker thread before exiting?
In this case, the worker thread can test such variable before starting, and, if it's true, it will go out in a clean way.