Results 1 to 8 of 8

Thread: BlockingQueuedConnection is not working it is leading to deadlock condition.

  1. #1
    Join Date
    Dec 2011
    Posts
    7
    Qt products
    Qt/Embedded

    Question 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
    Qt Code:
    1. connect (this, SIGNAL(moduleDatarcvd(int)), this, SLOT(ShowModuleSimWnd(int)),Qt::BlockingQueuedConnection);
    To copy to clipboard, switch view to plain text mode 

    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

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: BlockingQueuedConnection is not working it is leading to deadlock condition.

    As the friendly manual says:
    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?

  3. #3
    Join Date
    Dec 2011
    Posts
    7
    Qt products
    Qt/Embedded

    Default Re: BlockingQueuedConnection is not working it is leading to deadlock condition.

    ya exactly both the emitter and receiver are in different thread...

  4. #4
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,536
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: BlockingQueuedConnection is not working it is leading to deadlock condition.

    Quote Originally Posted by us@12 View Post
    ...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".

  5. #5
    Join Date
    Dec 2011
    Posts
    7
    Qt products
    Qt/Embedded

    Default Re: BlockingQueuedConnection is not working it is leading to deadlock condition.

    Qt Code:
    1. void VSDPM_CDT::DisplaySimWnd(int nModule)
    2. {
    3. emit moduleDatarcvd(nModule);
    4. }
    To copy to clipboard, switch view to plain text mode 

    Here i am emitting a signal i.e n module and at receiver side:
    Qt Code:
    1. connect (this, SIGNAL(moduleDatarcvd(int)), this, SLOT(ShowModuleSimWnd(int)),Qt::BlockingQueuedConnection);
    To copy to clipboard, switch view to plain text mode 

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

    Qt Code:
    1. void VSDPM_CDT::ShowModuleSimWnd(int nModule)
    2. {
    3. if(nModule == 0)
    4. {
    5. OnClickCanSimulation();
    6. }
    7. else if(nModule == 1)
    8. {
    9. OnClickLinSimulation();
    10. }
    11. else if(nModule == 2)
    12. {
    13. OnClickADCSimulation();
    14. }
    15. else if(nModule == 3)
    16. {
    17. OnClickDIOSimulation();
    18. }
    19. else if(nModule == 4)
    20. {
    21. OnClickPWMSimulation();
    22. }
    23. else if(nModule == 5)
    24. {
    25. ShowLogMessage("test","Inside module");
    26. OnClickTCPIPSimulation();
    27. }
    28. else if(nModule == 6)
    29. {
    30. OnClickBTSimulation();
    31. }
    32. }
    To copy to clipboard, switch view to plain text mode 

    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

  6. #6
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,536
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default 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.

  7. #7
    Join Date
    Dec 2011
    Posts
    7
    Qt products
    Qt/Embedded

    Default 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.

  8. #8
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,536
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default 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.

Similar Threads

  1. Replies: 3
    Last Post: 2nd January 2012, 11:57
  2. Replies: 4
    Last Post: 22nd July 2011, 10:42
  3. QFontMetrics::leading() returns negative value.
    By JantarManter in forum Qt Programming
    Replies: 0
    Last Post: 19th May 2010, 14:45
  4. BlockingQueuedConnection hang
    By ^NyAw^ in forum Qt Programming
    Replies: 7
    Last Post: 17th February 2010, 18:30
  5. Replies: 1
    Last Post: 6th November 2009, 18:33

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.