From 5b79ac0f50c746c4bad56a067dd10c84b00dfe0c Mon Sep 17 00:00:00 2001 From: Michael Pollind Date: Wed, 1 Sep 2021 07:12:16 -0700 Subject: [PATCH] chore: replace drain with poll for queue for GameThread --- .../main/java/org/terasology/engine/core/GameThread.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/engine/src/main/java/org/terasology/engine/core/GameThread.java b/engine/src/main/java/org/terasology/engine/core/GameThread.java index 052bec296bf..e881ff3ce59 100644 --- a/engine/src/main/java/org/terasology/engine/core/GameThread.java +++ b/engine/src/main/java/org/terasology/engine/core/GameThread.java @@ -70,9 +70,10 @@ public static void synch(Runnable process) throws InterruptedException { */ public static void processWaitingProcesses() { if (Thread.currentThread() == gameThread) { - List processes = Lists.newArrayList(); - pendingRunnables.drainTo(processes); - processes.forEach(Runnable::run); + Runnable inst; + while((inst = pendingRunnables.poll()) != null) { + inst.run(); + } } }