Skip to content

Commit 90a7ee4

Browse files
committed
replace yield() with sleep() as suggested by Gemini Code Assist
1 parent 9533d7e commit 90a7ee4

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

test/org/lwjgl/opengl/awt/CompareScreenshotTest.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -284,9 +284,11 @@ public void run() {
284284
// Some Operating Systems have a window open/close animation, so we wait until the screenshot is stable
285285
while (true) {
286286
// Pause at least 500 milliseconds between captures
287-
long pauseStartTime = System.currentTimeMillis();
288-
while (System.currentTimeMillis() - pauseStartTime < 500) {
289-
Thread.yield();
287+
try {
288+
Thread.sleep(500);
289+
} catch (InterruptedException e) {
290+
Thread.currentThread().interrupt();
291+
throw new RuntimeException("Thread interrupted during screenshot delay", e);
290292
}
291293

292294
BufferedImage s = rbt.createScreenCapture(frameBounds);

0 commit comments

Comments
 (0)