Results 1 to 6 of 6

Thread: QCop - QApplication::ProcessEvents()

  1. #1
    Join Date
    Jul 2008
    Posts
    139
    Thanks
    9
    Thanked 18 Times in 15 Posts
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Default QCop - QApplication::ProcessEvents()

    Hi,
    I am using QCopchannel to communicate within the same process. I am finding that sometime when I post an event in the QCopChannel, QCopChannel::send, the receive slot QCopChannel::receive is delayed upto 500-900ms.
    I did a test and subclassed QCopchannel, inside the object I made a QTimer (1ms). Anytime I recieve an event I start the timer. At the Timer timeout I execute QApplication::processEvents().
    Basically I am calling processEvents() every 1ms. Doing this seems to alleviate my delay problem. Seems that the event processing is not occurring fast enough.

    1) Can I execute processEvents() every millisecond? Is there going to be any side effects because of this?
    2) Is there another alternative to this? ( processing events faster)
    Thank you

  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: QCop - QApplication::ProcessEvents()

    What you do basically doesn't make much sense. The timer will only timeout when the flow is inside the event processing loop. So triggering the event processing from within event processing doesn't really do much. You might be abusing some undocumented behaviour or masking some other problem.
    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
    Jul 2008
    Posts
    139
    Thanks
    9
    Thanked 18 Times in 15 Posts
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Default Re: QCop - QApplication::ProcessEvents()

    Hi,
    It is just a test, I should have simplified the explaination.. sorry.
    Here is the basic setup
    I have a QTimer calling QApplication::processEvents() every X milliseconds.

  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: QCop - QApplication::ProcessEvents()

    My answer still stands. The timer's timeout signal can only be emitted from within QAbstractEventDispatcher::processEvents() so your solution is practically a no-op. It could be that you are starving the thread or the process. Try checking where the control flow is within this 500-900ms delay, maybe it gives you some ideas about the problem.
    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
    Jul 2008
    Posts
    139
    Thanks
    9
    Thanked 18 Times in 15 Posts
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Default Re: QCop - QApplication::ProcessEvents()

    So, I think what you are saying is if the event loop was not running, then the timer would not be timing out?! (i.e. The event loop is running as it should, but there is a delay somewhere else).
    I put an event filter on the app object and during that time there are only three qt events occurring. ( can't remember what they were right now). I guess it could be my other thread(s). I am sending a QCopChannel event in another thread. The thread has finished running at the time I send the event.
    Last edited by QbelcorT; 1st March 2009 at 11:21.

  6. #6
    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: QCop - QApplication::ProcessEvents()

    Quote Originally Posted by QbelcorT View Post
    So, I think what you are saying is if the event loop was not running, then the timer would not be timing out?!
    Yes, that's exactly what I'm saying.
    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.


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.