From 3d60482b46962b534fee510ef8b72421ec2ef4c5 Mon Sep 17 00:00:00 2001 From: "ShA..Rd" Date: Tue, 1 May 2012 14:19:12 +0000 Subject: [PATCH] * Fix paul complaining git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9340 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- engine/src/core/com/jme3/app/Application.java | 33 ++++++++----------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/engine/src/core/com/jme3/app/Application.java b/engine/src/core/com/jme3/app/Application.java index 510072562..f85897ad4 100644 --- a/engine/src/core/com/jme3/app/Application.java +++ b/engine/src/core/com/jme3/app/Application.java @@ -567,6 +567,18 @@ public class Application implements SystemListener { return task; } + /** + * Runs tasks enqueued via {@link #enqueue(Callable)} + */ + protected void runQueuedTasks() { + AppTask task; + while( (task = taskQueue.poll()) != null ) { + if (!task.isCancelled()) { + task.invoke(); + } + } + } + /** * Do not call manually. * Callback from ContextListener. @@ -575,26 +587,7 @@ public class Application implements SystemListener { // Make sure the audio renderer is available to callables AudioContext.setAudioRenderer(audioRenderer); - AppTask task = taskQueue.poll(); - toploop: do { - if (task == null) break; - while (task.isCancelled()) { - task = taskQueue.poll(); - if (task == null) break toploop; - } - task.invoke(); - } while (((task = taskQueue.poll()) != null)); - - /* I think the above is really just doing this: - AppTask task; - while( (task = taskQueue.poll()) != null ) { - if (!task.isCancelled()) { - task.invoke(); - } - } - //...but it's hard to say for sure. It's so twisted - //up that I don't trust my eyes. -pspeed - */ + runQueuedTasks(); if (speed == 0 || paused) return;