Results 1 to 5 of 5

Thread: Access to signal queue?

  1. #1
    Join Date
    Apr 2011
    Posts
    14
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Access to signal queue?

    Hello There,

    I have a bit of a problem with the signal queue and do hope that someone might give me a hint. There are two threads communicating with each other by emitting signals - works for the other on an existing QTcpSocket connection (it is an API implementation) and signals the other thread when sending and receiving of data was done - the decoded data is available.
    The problem is that signals look to be lost after a while, so signals emitted are never received in the thread handling the API via the QTcpSocket. I am looking for a way to debug it - I would like to see why the emitted signal does not arrive. It looks to be random how many times the emitted signal is actually received: sometime only 3x, sometimes much more before it actually gets stuck so emit is done (I see from the log file) but the slot is never triggered - same class, same thread, same instance does it many times before.

    Thanks,
    Sandor

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Access to signal queue?

    Make sure you handle the socket in the thread it lives in. A common error is to handle a socket in the QThread subclass object which does not live in the thread it controls.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Apr 2011
    Posts
    14
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Access to signal queue?

    "Make sure you handle the socket in the thread it lives in. A common error is to handle a socket in the QThread subclass object which does not live in the thread it controls."
    Nope, this has nothing to do with it (then Qt would give a bunch of warnings). The issue is that signals emitted are getting lost after a while. I was thinking that the thread locks on some control and put an additional log on locking/unlocking mutexes, and it does not.
    So, I just need a way to access the event queue of the thread for debugging so I can see at least if the message is there sitting and waiting, at all.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Access to signal queue?

    Signals can't be getting lost. Especially that they are not queued. Slots are queued but they are not getting lost. Maybe you have a deadlock somewhere in your code.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Access to signal queue?

    I agree with Wysota, signals can't be "getting lost". Either you are not sending them some times or your code blocks and signals are not delivered because of that.

    Have you looked at Conan? A "C++ library that provides run-time introspection of object hierarchies, object inheritance, signal/slot connections, and signal emissions."

Similar Threads

  1. clear emited signal queue
    By bibhukalyana in forum Qt Programming
    Replies: 2
    Last Post: 5th May 2011, 10:20
  2. Clearing the signal queue
    By grabalon in forum Qt Programming
    Replies: 7
    Last Post: 20th May 2010, 23:41
  3. help regarding queue
    By aj2903 in forum Qt Programming
    Replies: 1
    Last Post: 3rd April 2009, 07:48
  4. Access Violation on Signal Emit
    By khagzan in forum Qt Programming
    Replies: 2
    Last Post: 25th September 2007, 22:51
  5. Cannot queue...
    By vratojr in forum Qt Programming
    Replies: 3
    Last Post: 9th May 2006, 15:06

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.