[Interest] Heavily Commented Example: Simple Single Frontend with Two BackendsHi,
thiago.macieira at intel.com
Wed Oct 24 20:55:27 CEST 2012
On quarta-feira, 24 de outubro de 2012 14.37.14, K. Frank wrote:
> So, to summarize what you're saying, real world hardware is not
> excessively perverse.
> Therefore the volatile-bool scheme for signalling a thread to stop will
> work in practice (but volatile is not good enough for full-featured thread
> synchronization), because the hardware will cause the updated value
> of the stop flag to become visible to the polling thread in a reasonable
> amount of time. The polling thread might run a little longer than expected,
> but it will stop in a reasonable amount of time (for some reasonable
> definition of "reasonable").
But the correct way of doing that is to use a C11 or C++11 atomic load in
atomic_int flag = ATOMIC_VAR_INIT(0);
/* signal */
/* check if set */
C++11 has a C++ API in addition. QAtomicInt is similar to C++11's
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel Open Source Technology Center
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 190 bytes
Desc: This is a digitally signed message part.
More information about the Interest