public static void waitForTasks(long timeout) {
		waitForSwing();

		long time = 0;
		while (TaskUtilities.isExecutingTasks()) {
			time += sleep(DEFAULT_WAIT_DELAY);
			if (time >= timeout) {
				Msg.error(AbstractGenericTest.class, createStackTraceForAllThreads());
				throw new AssertionFailedError("Time expired waiting for tasks to complete.");
			}
		}

		// let any pending Swing work finish
		waitForSwing();
	}
Waits for all system tasks to complete. These tasks are tracked by the
SystemUtilities during testing only.

@throws AssertionFailedError if the timeout period expires while waiting
            for tasks
Ghidra/Framework/Gui/src/main/java/generic/test/AbstractGuiTest.java