private AnalysisTaskWrapper getNextTask(Integer limitPriority, TaskMonitor monitor) {
		if (monitor.isCancelled()) {
			cancelQueuedTasks();
		}

		if (!isEnabled || queue.isEmpty() ||
			(limitPriority != null && queue.getFirstPriority() >= limitPriority)) {
			return null;
		}
		int nextTaskPriority = queue.getFirstPriority();
		return new AnalysisTaskWrapper(queue.removeFirst(), nextTaskPriority);
	}
If invoked from an analysis task, treat as a yield and allow
task queue to be processed.
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/AutoAnalysisManager.java