menu
missing-spin-loop
Require a processor hint in atomic busy-wait loops
An atomic polling loop that performs no other work repeatedly reloads the atomic value without informing the processor that it is spinning.
Instead, you SHOULD call spinLoop during bounded optimistic spinning or use a blocking synchronization operation for longer waits.
Reported
1import { Atomic } from "destack:sync";2 3function wait(ready: &readonly Atomic<boolean>): void {4 while (!ready.load()) {}5}Accepted
1import { spinLoop } from "destack:hint";2import { Atomic } from "destack:sync";3 4function wait(ready: &readonly Atomic<boolean>): void {5 while (!ready.load()) {6 spinLoop();7 }8}