Skip to content

Commit

Permalink
chore: replace drain with poll for queue for GameThread
Browse files Browse the repository at this point in the history
  • Loading branch information
pollend committed Sep 1, 2021
1 parent cfcc712 commit 5b79ac0
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,10 @@ public static void synch(Runnable process) throws InterruptedException {
*/
public static void processWaitingProcesses() {
if (Thread.currentThread() == gameThread) {
List<Runnable> processes = Lists.newArrayList();
pendingRunnables.drainTo(processes);
processes.forEach(Runnable::run);
Runnable inst;
while((inst = pendingRunnables.poll()) != null) {
inst.run();
}
}
}

Expand Down

0 comments on commit 5b79ac0

Please sign in to comment.