Versions Compared

Key

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

...

This compliant solution declares the variables as volatile. Writes and reads of volatile long and double values are always atomic.

...

This compliant solution synchronizes calls to methods one() and two()}}. This guarantees these two method calls are treated as atomic operation, including reading and writing to the variable i.

...