Results 1 to 4 of 4

Thread: Qt event queue overloading?

  1. #1
    Join Date
    Mar 2008
    Posts
    6

    Default Qt event queue overloading?

    OK so I'm writing a program in PyQT (Qt3.3), and I've got a stickler of a problem. I'll try to be brief: basically I have a thread that programs some hardware over a range of values (just a sweep type of thing), and at each value, I collect some information, and pass it back to the main event thread for handling.

    The handling is a little involved, requires querying a backend over a socket, searching an internal dictionary or two for matching results, updating an on screen table and possible updating the display in a little modal dialog. There aren't any heavy duty calculations going on.

    Originally, I was polling the hardware up to 16x/second and sending each response through a custom event to the main gui for handling. This was breaking things (described below), so I switched to dumping the responses into a list (wrapped in a mutex), and then sending a single event if there was anything the GUI needed to handle (instead of getting the data from the event, the GUI now gets it by popping results off the list).

    At any rate, both these techniques result in one thing: my event queue dies. There's no exceptions/errors/segfaults or anything, it simply stops processing. I can see that the scanning thread is still active (it still prints out and everything), but the main gui is just dead, no repaint or anything. I even put a QTimer with a zero timeout in that just prints "Event queue is idle!" and sure enough, it stops printing, confirming that the event queue is dead.

    So my question is, has anyone seen this kind of behavior? Is it possible to destroy the event queue by having too complex of an event handler? This is a real stumper for me, especially since the data being sent back to the main GUI on each event is < 64 bytes.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    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: Qt event queue overloading?

    Quote Originally Posted by gct View Post
    So my question is, has anyone seen this kind of behavior? Is it possible to destroy the event queue by having too complex of an event handler?
    No, not really. I think you are facing one of two issues... either you have code that locks itself in your custom event handler causing the whole processing to stop or events are arriving into the queue at a much higher rate than they are processed causing the event handling mechanism to choke. I see no other possibility... unless there's some Python or PyQt issue involved.

  3. #3
    Join Date
    Mar 2008
    Posts
    6

    Default Re: Qt event queue overloading?

    That's what I thought to, but I don't have any shared objects in my event handler, so I have no mutexes that could be getting locked causing it to stall...

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    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: Qt event queue overloading?

    Maybe some infinite loop?

Similar Threads

  1. Replies: 1
    Last Post: 16th October 2007, 22:41
  2. Event Queue Question
    By TheGrimace in forum Qt Programming
    Replies: 10
    Last Post: 5th October 2007, 16:55
  3. Replies: 6
    Last Post: 21st September 2007, 13:51
  4. The event fired by the mouse click on the frame
    By Placido Currò in forum Qt Programming
    Replies: 8
    Last Post: 3rd March 2007, 09:05
  5. Workload in a QThread blocks main application's event loop ?
    By 0xBulbizarre in forum Qt Programming
    Replies: 14
    Last Post: 9th April 2006, 21:55

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.