Em seg 24 mar 2014, às 16:27:06, André Somers escreveu:
> The point is, that usually you don't _need_ synchronization for this 
> purpose, and using synchronization does come at a cost. It is usually 
> not critical that the worker thread stops immediately when signalled, 
> just that it stops soon. So even if - due to missing synchronization and 
> the thread reading the flag at the same time it being changed - the 
> worker does an other iteration before stopping, nothing is lost. All 
> that happens is that the thread does a little bit of work that was not 
> needed. The bonus is that the rest of the time, no synchronization is 
> needed at all, which may result in better performance.

Note that using a regular, non-atomic variable could mean that the thread 
takes a LONG time to see the change, depending on the architecture and OS 
scheduling.
-- 
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

Reply via email to