...
Noncompliant Code Example
Wiki Markup |
---|
This noncompliant code example declares a non-volatile {{Boolean}} flag. "The compiler is free to read the field {{this.done}} just once, and reuse the cached value in each execution of the loop. This would mean that the loop would never terminate, even if another thread changed the value of {{this.done}}." \[[JLS 05|AA. Java References#JLS 05]\]. |
Code Block | ||
---|---|---|
| ||
private Boolean done; while (!this.done) Thread.sleep(1000); |
...