[Qt-interest] QAtomicInt and QThread
Arnold Krille
arnold at arnoldarts.de
Sat Jun 25 20:13:07 CEST 2011
On Friday 24 June 2011 17:47:23 Thiago Macieira wrote:
> Em Friday, 24 de June de 2011, às 11:52:24, Arnold Krille escreveu:
> > On Friday 24 June 2011 11:38:31 Thiago Macieira wrote:
> > > I see some manipulation of a non-atomic 64-bit int inside a loop and
> > > reading of the same 64-bit integer from another function. Since you
> > > didn't try to use the atomic there, I don't suppose you care that this
> > > is non-atomic and can produce weird results.
> >
> > Maybe thats because a 64bit integer is needed here but QAtomicInt is only
> > 32bit?
> There's a reason why QAtomicInt is 32-bit.
Right, theres platform dependant operations in there that are only guaranteed
to be atomic on the lowest denominator.
> > I had that problem in my software and "solved" it by copying the
> > QAtomicInt sources into my code-tree to create a QAtomicInt64...
> Only works on a 64-bit platform.
Actually I was wrong, I didn't need (and create) a 64bit atomic-int, but a
semaphore with a 64bit counter. Its actually QSemaphore64 I created by
copying. And that works well on 32 and 64 bits...
Have a nice weekend,
Arnold
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110625/db0b6e45/attachment.bin
More information about the Qt-interest-old
mailing list