[Qt-interest] BlockingQueuedConnection where and how to ?!
Mihail Naydenov
mlists at ymail.com
Wed Dec 2 18:07:42 CET 2009
Im have attached a small and (not so) simple test.
It creates a list of 1000 list items, then randomly selects some of them.
The selected items are send to a worker, living, indeed on diff thread.
In a signal handler, the worker, starts a concurrent mapped work on the list.
The work itself is fake (just the stupid for loop)
Thats it. No explicit synchronization is need, because no data is accessed, just the Qt signal slot machinery.
Now, if the slot is connected non blocking the app crashes (randomly, but within a minute or two)
I dont see the clear reason for the crash, and at first I thought it was a QtConcurrent bug (disappears if I don't get the result back!)
Anyway, I am interested in opinions if it is possible to avoid the blocking, and why its is needed in such simple scenario.
Thank You
MihailNaydenov
P.S. Note that if I remove the worker class and implement its job also in the list class, again using signals and slots, but with explicit QueuedConnection,
the app also crashes! This is, without having a second object in a diff thead, just one object and QueuedConnection for the slots.
Original Message ----
> From: Ender EREL <erelender at yahoo.com>
> To: qt-interest at trolltech.com
> Sent: Wed, December 2, 2009 5:54:36 PM
> Subject: Re: [Qt-interest] BlockingQueuedConnection where and how to ?!
>
> I think instead of avoiding the crash, you should dig deeper, find what
> causes it and resolve the issue.
>
> In my opinion, BlockingQueuedConnection makes sense when your signal is
> connected to a slot of an object living in another thread but you need
> the signalling thread to continue only after the slot is delivered. This
> need may arise when a syncronisation is required somehow.
>
> --
> Ender EREL
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
-------------- next part --------------
A non-text attachment was scrubbed...
Name: QueuedCrash.cpp
Type: text/x-c
Size: 3199 bytes
Desc: not available
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091202/11de9a80/attachment.bin
More information about the Qt-interest-old
mailing list