[Qt-interest] Problems with threads and explicitely shared data

Arnold Krille arnold at arnoldarts.de
Thu Oct 1 22:27:00 CEST 2009


Hi all,

the subject already describes the problem. For our scientific data evaluation I 
send data around a lot. These chains for the evaluation can split where both 
ways of handling the data are possible: Sometimes the data is sent on to only 
one of the connected receivers, sometimes it is sent to all of them. As 
copying the data is costly (double-arrays of 200-4000 values plus a hash of 
QString->double), the data inside these datasets is implicitly shared between 
copies of the datasets.
But there a problem arises:

Although I use Qt's shared data pointer, it crashes occasionally (ie. after 
about 30000 successfully sent datasets).
I also tried using my own reference counting with QAtomicInt but the result is 
the same.
Even protecting the copy-constructor, operator= and the destructor with a 
mutex doesn't help.

Attached you can find a small mini-project which reproduces the problem. (All 
the data-handling functions are stripped, only the bare necessities are left.)

Maybe you can run it on your machine and tell me whether it works with your 
setup?
Maybe you can look at the problem and tell me whether there is a problem in 
the source?

Or is this a known problem in Qt?

Thanks in advance,

Arnold, who has been banging his head on several walls for several months 
now...
-------------- next part --------------
A non-text attachment was scrubbed...
Name: epos-extract.tar.bz2
Type: application/x-bzip-compressed-tar
Size: 9495 bytes
Desc: not available
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091001/14a7aadf/attachment.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091001/14a7aadf/attachment-0001.bin 


More information about the Qt-interest-old mailing list