Versions Compared

Key

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

...

While this is an acceptable compliant solution, it has the following disadvantages compared to declaring done as {{ volatile:

  • Performance: The intrinsic locks cause threads to block temporarily; volatile incurs no blocking
  • Deadlock: Improper use of locks can lead to deadlocks. Because the use of volatile incurs no blocking, deadlock cannot occur.

...