On 2017-05-26 15:56, Graeme Geldenhuys wrote:
Attached is the corrected version of your sample application without the
volatile keyword. It is worth noting that using volatile is faster, but
also has its limits (ie: you can't protect a whole block of code or
actions).

To add to this, there is also a memory access effect between volatile and synchronize. For a detailed explanation, take a look the marked "correct answer" in this StackOverflow topic:


https://stackoverflow.com/questions/3519664/difference-between-volatile-and-synchronized-in-java



Regards,
  Graeme

--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp
_______________________________________________
fpc-other maillist  -  fpc-other@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-other

Reply via email to