[Qt-interest] cross thread signals slots and event queue

Alexander Kurz lewi.alex at gmail.com
Tue Jan 5 11:58:37 CET 2010


Hi All,

I would like to use signals and slots with queued connection between 2
threads.

Thread A listens on a serial channel and receives data let's say every 1
sec.
Thread B does some calculation with the received data.

When the calculation takes now longer than 1 second the queue where the
signals are queued gets bigger and bigger until I run out of memory...

Before Qt I used shared memory, mutexes, waitconditions for synchronisation.
Like you would implement a consumer/producer pattern but with only 1 shared
data memory and no queue. There it was no problem because it always used the
latest data for calculation and no queue got expanded.

I would really like to use signals and slots for this usecase because it
would makes things much easier and less code.

I need a mechanism to limit the size of the event queue of a specific thread
or to queue only signals that are not queued already. I could not find
anything like this in the documentation, so maybe someone here could give me
a hint.

Thanks
Lewi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100105/c6b0f5c9/attachment.html 


More information about the Qt-interest-old mailing list