...
Code Block | ||
---|---|---|
| ||
private Boolean done; while (!this.done) { Thread.sleep(1000); } |
Compliant Solution
This compliant solution declares the flag volatile
to ensure that updates to it are seen immediately across multiple threads.
...
...
Code Block | ||
---|---|---|
| ||
private Boolean done; while (!this.done) { Thread.sleep(1000); } |
This compliant solution declares the flag volatile
to ensure that updates to it are seen immediately across multiple threads.
...