Inspectopedia
 
2024.3

'wait()' not in loop

Warning
Reliability
New
Last modified: 03 December 2024

Reports calls to wait() not made inside a loop.

wait() is normally used to suspend a thread until a condition is true, and that condition should be checked after the wait() returns. A loop is the clearest way to achieve this.