Versions Compared

Key

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

Reading a shared primitive variable in one thread may not yield the value of the most recent write to the variable from another thread. Multiple Consequently, multiple threads may observe stale values of the shared variable and fail to perform the necessary actions on a timely basis. Visibility of the most recent update can be ensured by declaring the variable as volatile or correctly synchronizing the reads and writes to the variable.

...