Files
2025-02-05 04:43:28 +00:00

22 lines
585 B
HTML

<html>
<body>
Reports calls to <code>java.lang.Thread.sleep()</code> that occur inside loops.
<p>Such calls
are indicative of "busy-waiting". Busy-waiting is often inefficient, and may result in unexpected deadlocks
as busy-waiting threads do not release locked resources.</p>
<p><b>Example:</b></p>
<pre><code>
class X {
volatile int x;
public void waitX() throws Exception {
while (x &gt; 0) {
Thread.sleep(10);//warning: Call to 'Thread.sleep()' in a loop, probably busy-waiting
}
}
}
</code></pre>
<!-- tooltip end -->
<p>
</body>
</html>