From d6da78251e50da9faf87a4c3414c92df015cbf0c Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Fri, 17 Jun 2016 23:20:49 +1000 Subject: [PATCH] Tweak parallel startset --- core/src/main/java/com/boydti/fawe/util/SetQueue.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/com/boydti/fawe/util/SetQueue.java b/core/src/main/java/com/boydti/fawe/util/SetQueue.java index 120d9f39..7f7a6447 100644 --- a/core/src/main/java/com/boydti/fawe/util/SetQueue.java +++ b/core/src/main/java/com/boydti/fawe/util/SetQueue.java @@ -187,9 +187,10 @@ public class SetQueue { throw new IllegalStateException("Must be flushed on the main thread!"); } // Disable the async catcher as it can't discern async vs parallel - SET_TASK.value2.startSet(true); + boolean parallel = Settings.PARALLEL_THREADS <= 1; + SET_TASK.value2.startSet(parallel); try { - if (Settings.PARALLEL_THREADS <= 1) { + if (parallel) { SET_TASK.run(); } else { ArrayList threads = new ArrayList(); @@ -211,7 +212,7 @@ public class SetQueue { MainUtil.handleError(e); } finally { // Enable it again (note that we are still on the main thread) - SET_TASK.value2.endSet(true); + SET_TASK.value2.endSet(parallel); dequeue(queue); } }