Versions Compared

Key

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

An infinite loop with an empty body is a suboptimal solution , because it consumes CPU cycles but does nothing. Optimizing compilers and JITs are permitted to remove such a loop, which can lead to unexpected results. Consequently, programs must not include infinite loops with empty bodies.

...

This compliant solution avoids use of a meaningless infinite loop by sleeping the current thread within the while loop. The loop body contains semantically meaningful operations , and consequently cannot be optimized away.

...

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="17d218c64ee901b8-6d47d9f7-446f4188-a5dc81b5-663df7af5b25d4f52b1ddc3f"><ac:plain-text-body><![CDATA[

[[API 2006

https://www.securecoding.cert.org/confluence/display/java/AA.+Java+References#AA.JavaReferences-API06]]

]]></ac:plain-text-body></ac:structured-macro>

...