[Qt-interest] cross thread signals slots and event queue
Bradley T. Hughes
bradley.hughes at nokia.com
Tue Jan 5 13:06:18 CET 2010
On 01/05/2010 11:58 AM, Alexander Kurz wrote:
> 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.
There's nothing like this (yet)... the closest thing is
Qt::BlockingQueuedConnection (which essentially means there will never be a
queue).
--
Bradley T. Hughes (Nokia-D-Qt/Oslo), bradley.hughes at nokia.com
Sandakervn. 116, P.O. Box 4332 Nydalen, 0402 Oslo, Norway
More information about the Qt-interest-old
mailing list