@Override
	public void run() {
		try {

			Msg.debug(this, time() + "Background processing started...");
			startQueueTime = System.currentTimeMillis();
			for (BackgroundCommandTask<?> task = getNextTask(); task != null; task =
				getNextTask()) {

				Msg.debug(this, time() + "Task Start: " + task.getTaskTitle());
				startTaskTime = System.currentTimeMillis();

				synchronized (this) {
					currentTask = task;
				}

				if (task.isModal()) {
					modalTaskDialog = new TaskDialog(task);
					modalTaskDialog.show(0);
					task.run(modalTaskDialog);
				}
				else {
					toolTaskMonitor.initialize(task);
					task.run(toolTaskMonitor);
				}
			}

			double totalTime = (System.currentTimeMillis() - startQueueTime) / 1000.00;
			Msg.debug(this, time() + "Background processing complete (" + totalTime + " secs)");
		}
		finally {
			synchronized (this) {
				currentTask = null;
			}
		}
	}
Cancel the currently running task and clear all commands that are scheduled to run. Block
until the currently running task ends.

@param monitor a monitor to cancel waiting for the task to finish
Ghidra/Framework/Project/src/main/java/ghidra/framework/plugintool/mgr/ToolTaskManager.java