PDA

View Full Version : BlockingQueuedConnection is not working it is leading to deadlock condition.



us@12
22nd December 2011, 05:43
Hi everyone,
I am uing Qt:: BlockingQueuedConnection in the connect option like below, but it going to deadlock state when i use this please help me in this issue soon am a newbie to Qt.. Here is my code


connect (this, SIGNAL(moduleDatarcvd(int)), this, SLOT(ShowModuleSimWnd(int)),Qt::BlockingQueuedConn ection);

here i am waiting for a signal to come when my ShowmoduleSimWnd method is called. please tell me an alternative that wath i can use.and for this blocking of my ui is happening. please help me

ChrisW67
22nd December 2011, 05:55
Don't ask the same question in two places... it is bad manners and only serves to fracture any response.

us@12
22nd December 2011, 06:08
Sorry i am new to this forum..

amleto
22nd December 2011, 18:29
rtfm ;)


Qt::BlockingQueuedConnection - Same as QueuedConnection, except the current thread blocks until the slot returns. This connection type should only be used where the emitter and receiver are in different threads. Note: Violating this rule can cause your application to deadlock.

http://doc.qt.nokia.com/4.7-snapshot/qt.html#ConnectionType-enum

us@12
27th December 2011, 10:14
void VSDPM_CDT::DisplaySimWnd(int nModule)
{
emit moduleDatarcvd(nModule);
}

Here i am emitting a signal i.e n module and at receiver side:


connect (this, SIGNAL(moduleDatarcvd(int)), this, SLOT(ShowModuleSimWnd(int)),Qt::BlockingQueuedConn ection);

and my ShowmoduleSimWnd is a method which will be called when it is received a signal i.e



void VSDPM_CDT::ShowModuleSimWnd(int nModule)
{
if(nModule == 0)
{
OnClickCanSimulation();
}
else if(nModule == 1)
{
OnClickLinSimulation();
}
else if(nModule == 2)
{
OnClickADCSimulation();
}
else if(nModule == 3)
{
OnClickDIOSimulation();
}
else if(nModule == 4)
{
OnClickPWMSimulation();
}
else if(nModule == 5)
{
ShowLogMessage("test","Inside module");
OnClickTCPIPSimulation();
}
else if(nModule == 6)
{
OnClickBTSimulation();
}
}

in lin if(nModule == 5) i am getting a problem. Actually i am blocking the queue here to wait for a signal to come. please help me in this scenario

amleto
27th December 2011, 11:09
You have not given enough information. May I direct you to my signature.