Tweak parallel startset

This commit is contained in:
Jesse Boyd 2016-06-17 23:20:49 +10:00
parent 3bab344656
commit d6da78251e

View File

@ -187,9 +187,10 @@ public class SetQueue {
throw new IllegalStateException("Must be flushed on the main thread!"); throw new IllegalStateException("Must be flushed on the main thread!");
} }
// Disable the async catcher as it can't discern async vs parallel // 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 { try {
if (Settings.PARALLEL_THREADS <= 1) { if (parallel) {
SET_TASK.run(); SET_TASK.run();
} else { } else {
ArrayList<Thread> threads = new ArrayList<Thread>(); ArrayList<Thread> threads = new ArrayList<Thread>();
@ -211,7 +212,7 @@ public class SetQueue {
MainUtil.handleError(e); MainUtil.handleError(e);
} finally { } finally {
// Enable it again (note that we are still on the main thread) // Enable it again (note that we are still on the main thread)
SET_TASK.value2.endSet(true); SET_TASK.value2.endSet(parallel);
dequeue(queue); dequeue(queue);
} }
} }