PDA

View Full Version : Difference between Qt::QueuedConnection vs Qt::BlockingQueuedConnection



ShaChris23
6th November 2009, 18:15
What is the difference between Qt::QueuedConnection vs Qt::BlockingQueuedConnection

So, reading from here (http://doc.trolltech.com/4.3/qt.html) (search for ConnectionType)

Qt.QueuedConnection -> When emitted, the signal is queued until the event loop is able to deliver it to the slot.

Qt.BlockingQueuedConnection -> Same as QueuedConnection, except that the current thread blocks until the slot has been delivered. This connection type should only be used for receivers in a different thread. Note that misuse of this type can lead to dead locks in your application.

My question is, if BlockingQueuedConnection is the same as QueuedConnection, why would "the current thread blocks until the slot has been delivered"? Isn't the whole point of having a queued connection to prevent the signaler from blocking?

squidge
6th November 2009, 18:33
If you are using locally allocated memory (Eg. on the stack), then you don't want to delete that memory until the slot is called and completed, thus you would use a BlockingQueuedConnection.