Busy Loop In Coroutine (ARCH8033)
Esta página aún no está disponible en tu idioma.
Key kotlin.async.busy-loop-in-coroutine · Severity warning · Category async
Flags a while(true) loop inside launch / async with no delay, yield or suspension - it never lets the dispatcher run anything else.
Incorrect
Section titled “Incorrect”launch { while (true) { if (ready()) break } }Correct
Section titled “Correct”launch { while (isActive && !ready()) { delay(50) } }Suspend inside the loop (delay, yield, a channel receive) so the thread is released.