...
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;
volatileincurs no blocking - Deadlock: Improper use of locks can lead to deadlocks. Because the use of
volatileincurs no blocking, deadlock cannot occur.
...