[fpc-other] Felipe: Java and multi-threading

Graeme Geldenhuys mailinglists at geldenhuys.co.uk
Fri May 26 17:50:14 CEST 2017


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


More information about the fpc-other mailing list