[Interest] QTSPCosket signal disconnected()

Lincoln Ramsay lincoln.ramsay at nokia.com
Wed Aug 22 02:13:03 CEST 2012


On 08/21/2012 06:17 PM, ext Igor Mironchik wrote:
> But just imagine a situation in which the potential for double locking
> in a one-threaded environment is posiible.
> It is not possible at all.

Sure it is.

For one thing, emitting a signal to an object on the same thread usually 
calls the receiving slot immediately. This may not be what you were 
expecting. You can use a queued connection to ensure your slot is not 
called until the event loop spins again.

connect(something, SIGNAL(foo()), this, SLOT(bar()), Qt::QueuedConnection);

Depending on the design of your code, this can lead to a re-entrant 
calling of a function that doesn't handle it (ie. your deadlock case).

eg.
yourfunc() -> something() -> disconnect() -> slotDisconnected() -> 
yourfunc() -> deadlock


-- 
Lincoln Ramsay - Senior Software Engineer
Qt Development Frameworks, Nokia - http://qt.nokia.com/



More information about the Interest mailing list