[Qt-interest] QAtomicInt and QThread
Francisco Gonzalez
gzmorell at gmail.com
Fri Jun 24 12:41:43 CEST 2011
2011/6/24 Thiago Macieira <thiago at kde.org>:
> On Friday, 24 de June de 2011 10:46:44 Francisco Gonzalez wrote:
>> this example compiles and run ok, but is it correct?
>
> Maybe it is. We don't know what you're trying to do.
>
> We can't tell if it is correct or not if we don't know what it's supposed to
> do and what the conditions are. Please explain them too.
Definitively the example is not good.
The questions were: Does all the methods and data of "object" live in
the same thread after doing "object.moveToThread(&thread);"
If it is the case, as we use methods to retrieve data from the object
we do not need to block to be safe?
So in this case the read() method will be safe?
If we want to modify shared data directly, may we use QAtomicInt to
block the part of the code that is writing on the code?
More information about the Qt-interest-old
mailing list