void () { Semaphore mayStop1 = new Semaphore(1); Semaphore mayStop2 = new Semaphore(1); ProgressIndicatorBase taskProgress = new ProgressIndicatorBase(); Future<?> task = startBackgroundProcess( taskProgress, () -> ProgressSuspender.markSuspendable(taskProgress, ""), () -> ProgressManager.getInstance().executeNonCancelableSection(() -> workUntilStopped(mayStop1, taskProgress))); Future<?> unrelated = startBackgroundProcess( new ProgressIndicatorBase(), () -> {}, () -> ProgressManager.getInstance().executeNonCancelableSection( () -> workUntilStopped(mayStop2, ProgressManager.getInstance().getProgressIndicator()))); suspendProgressAndRun(taskProgress, () -> { mayStop1.up(); mayStop2.up(); letBackgroundThreadsSuspend(); assertFalse(task.isDone()); assertThreadCompleted(unrelated); }); assertThreadCompleted(task); }