Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Wiki Markup
If a thread initializes the {{Helper}} object, a [happens-before relationship|BB. Definitions#happens-before order] is established between this thread and another that retrieves and returns the instance. \[[Pugh 2004|AA. Java References#Pugh 04]\], and \[[Manson 2004|AA. Java References#Manson 04]\].

Compliant Solution (Static Initialization)

...

Wiki Markup
*LCK10-EX1:* The noncompliant form of the double-checked locking idiom can be used for for 32-bit primitive values (for example, {{int}} or {{float}}) \[[Pugh 2004|AA. Java References#Pugh 04]\]. Note that it does not work for {{long}} or {{double}} because unsynchronized reads/writes of 64-bit primitives are not guaranteed to be atomic (see guideline [VNA05-J. Ensure atomicity when reading and writing 64-bit values].)

...