[Qt-interest] Temporarily 'ignoring' QIODevice::readyRead() in multithreaded app

Preet preet.desai at gmail.com
Mon Dec 7 18:55:37 CET 2009


Hi,

Thank you for the reply.

I didn't quite follow some of it. So if I call readAll() in my slot that is
connected to the readyRead() signal, it will automatically ignore subsequent
readyRead() signals?

> So when your slot isn't finished by the time the new signal arrives, that
is
> not a problem per se as the next signal-slot will only execute afterwards.

I didn't get what you meant by 'execute afterwards'...

Within the same thread is there anyway I can ensure that a slot that is
signaled runs to completion?



On Mon, Dec 7, 2009 at 12:27 PM, Arnold Krille <arnold at arnoldarts.de> wrote:

> Hi,
>
> On Monday 07 December 2009 16:33:12 Preet wrote:
> > However the problem in this is that the device may generate a lot of data
> >  at once, either repeatedly emitting readyRead() in my application, or
> >  emitting readyRead() very sparsely. When a lot of data is generated
> >  spontaneously, my signal handler (slot) is unable to finish execution
> >  without being preempted by the readyRead() signal. I need a way to
> >  'ignore' signals after receiving readyRead() initially, and then enable
> >  signals once again when my signal handler function has completed
> >  execution.
>
> afaik, readyRead is emitted only when new data has arrived. But also every
> time when new data has arrived.
> So when your slot isn't finished by the time the new signal arrives, that
> is
> not a problem per se as the next signal-slot will only execute afterwards.
> The easiest solution is to read as long as data is in the iodevice. This
> will
> automatically join multiple readyRead signals when this fires while your
> slot
> is running. And the slot-calls after that will just do nothing because
> there
> is no more data in the devices buffer.
>
> Is that explained understandable?
>
> Have fun,
>
> Arnold
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091207/361de7c2/attachment.html 


More information about the Qt-interest-old mailing list