private static <R> List<R> doDecompileFunctions(QCallback<Function, R> callback,
			Iterator<Function> functions, int count, TaskMonitor monitor)
			throws InterruptedException, Exception {

		DecompilerConcurrentQ<Function, R> queue =
			new DecompilerConcurrentQ<>(callback, THREAD_POOL_NAME, monitor);

		monitor.initialize(count);

		queue.addAll(functions);

		Collection<QResult<Function, R>> qResults = null;
		try {
			qResults = queue.waitForResults();
		}
		finally {
			queue.dispose();
		}

		List<R> results = new ArrayList<>();
		for (QResult<Function, R> qResult : qResults) {
			results.add(qResult.getResult());
		}

		return results;
	}
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