[Interest] QThread

Etienne Sandré-Chardonnal etienne.sandre at m4x.org
Mon Mar 24 16:11:16 CET 2014


volatile is not providing synchronization guarantees in the standard. Even
if it may work on most platforms with bool, this is not a good practice.

std::atomic<bool> or QAtomicInt will do the job.

2014-03-24 13:40 GMT+01:00 André Somers <andre at familiesomers.nl>:

>  Protecting it with a mutex is usually not needed, and it doesn't need to
> be global either. However, you may want to use a QAtomicInt or a
> volatile bool as your flag type, and you can make that a member variable
> of your worker class that can be set with a simple method call.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20140324/8af2ce18/attachment.html>


More information about the Interest mailing list