BlockingQueuedConnection is not working it is leading to deadlock condition.
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
Code:
connect (this, SIGNAL(moduleDatarcvd(int)), this, SLOT(ShowModuleSimWnd(int)),Qt::BlockingQueuedConnection);
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
Re: BlockingQueuedConnection is not working it is leading to deadlock condition.
As the friendly manual says:
Quote:
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.
Are your sender and receiver in separate threads?
Re: BlockingQueuedConnection is not working it is leading to deadlock condition.
ya exactly both the emitter and receiver are in different thread...
Re: BlockingQueuedConnection is not working it is leading to deadlock condition.
Quote:
Originally Posted by
us@12
...here i am waiting for a signal to come when my ShowmoduleSimWnd method is called...
Please show a code. I think that a problem is "i am waiting".
Re: BlockingQueuedConnection is not working it is leading to deadlock condition.
Code:
void VSDPM_CDT::DisplaySimWnd(int nModule)
{
emit moduleDatarcvd(nModule);
}
Here i am emitting a signal i.e n module and at receiver side:
Code:
connect (this, SIGNAL(moduleDatarcvd(int)), this, SLOT(ShowModuleSimWnd(int)),Qt::BlockingQueuedConnection);
and my ShowmoduleSimWnd is a method which will be called when it is received a signal i.e
Code:
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
Re: BlockingQueuedConnection is not working it is leading to deadlock condition.
But it is SLOT ! You are entering ShowModuleSimWnd(int nModule) as reaction on blocking signal. You can not pick up the next signal before the end of the previous operation.
Re: BlockingQueuedConnection is not working it is leading to deadlock condition.
Ya but how can i solve this problem i have to block the queue until my method get finished.. how my approach should be for this.
Re: BlockingQueuedConnection is not working it is leading to deadlock condition.
You can not wait that someone will come if you closed the door. You have to design the logic of the system from scratch.