private void doDecompile(Iterator<Function> iter, int functionCount)
			throws InterruptedException, Exception {
		taskMonitor.setMessage("Analyzing functions...");
		taskMonitor.initialize(functionCount);

		CachingPool<DecompileFunctionTask> decompilerPool =
			new CachingPool<DecompileFunctionTask>(new DecompilerTaskFactory(ftask_template));
		QCallback<Function, Function> callback = new ParallelDecompilerCallback(decompilerPool);

		queue = new DecompilerConcurrentQ<Function, Function>(callback, taskMonitor);

		queue.addAll(iter);
		try {
			queue.waitUntilDone();
		}
		finally {
			queue.dispose();
			decompilerPool.dispose();
		}
	}
Run decompilation across multiple functions in a single program, distributing the task across
a specific number of threads
Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/ParallelDecompileTask.java