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
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.
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.
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.
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.
Re: QCop - QApplication::ProcessEvents()
Quote:
Originally Posted by
QbelcorT
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.