void (@NotNull Supplier<Boolean> busyCondition) { assertDispatchThreadWithoutWriteAccess(); long startTimeMillis = System.currentTimeMillis(); while (busyCondition.get()) { assertMaxWaitTimeSince(startTimeMillis); TimeoutUtil.sleep(5); UIUtil.dispatchAllInvocationEvents(); } }