Except in this particular case where: - The flag is set to false at the start of the thread - Set to true for stopping by the controlling(parent) thread (writen, never read) - Checked by the thread as a quit condition (read, never written)
In that case, there is absolutely no possible race condition & undefined state. No thread makes composite access (fetch and set, fetch & add, etc...) OK, that's not worth the discussion since the cost of atomic is negligible and it's definitely a better habit to use atomics everywhere for values accessed between threads. Etienne 2013/6/22 Thiago Macieira <thiago.macie...@intel.com> > On sábado, 22 de junho de 2013 12.41.10, Tony Rietwyk wrote: > > But a bool value can be cached indefinitely, so make sure you declare the > > flag as volatile! > > That's wrong and has been explained away several times. You need to > declare it > as atomic, not as volatile. > > -- > Thiago Macieira - thiago.macieira (AT) intel.com > Software Architect - Intel Open Source Technology Center > > _______________________________________________ > Interest mailing list > Interest@qt-project.org > http://lists.qt-project.org/mailman/listinfo/interest > >
_______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest