public static <R> void decompileFunctions(QCallback<Function, R> callback, Program program,
			Iterator<Function> functions, Consumer<R> resultsConsumer, TaskMonitor monitor)
			throws InterruptedException, Exception {

		int max = program.getFunctionManager().getFunctionCount();
		boolean collectResults = false; // the client will process results as they arrive
		GThreadPool threadPool = GThreadPool.getSharedThreadPool(THREAD_POOL_NAME);
		DecompilerConcurrentQ<Function, R> queue =
			new DecompilerConcurrentQ<>(callback, threadPool, collectResults, monitor);

		monitor.initialize(max);
		queue.process(functions, resultsConsumer);
		queue.waitUntilDone();
	}
Decompile the given functions using multiple decompilers.

<p>Results will be passed to the given consumer as they are produced.  Calling this
method allows you to handle results as they are discovered.

<p><strong>This method will wait for all processing before returning.</strong>

@param callback the callback to be called for each that is processed
@param program the program
@param functions the functions to decompile
@param resultsConsumer the consumer to which results will be passed
@param monitor the task monitor
@throws InterruptedException if interrupted
@throws Exception if any other exception occurs
Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/parallel/ParallelDecompiler.java