void () { Semaphore mayStop1 = new Semaphore(1); Semaphore mayStop2 = new Semaphore(1); ProgressIndicatorBase progress = new ProgressIndicatorBase(); Ref<Future<?>> innerTask = Ref.create(); Future<?> task = startBackgroundProcess( progress, () -> { ProgressSuspender.markSuspendable(progress, ""); innerTask.set(startBackgroundProcess(new ProgressIndicatorBase(), () -> {}, () -> workUntilStopped(mayStop2, progress))); }, () -> workUntilStopped(mayStop1, progress)); suspendProgressAndRun(progress, () -> { mayStop1.up(); mayStop2.up(); letBackgroundThreadsSuspend(); assertFalse(task.isDone()); assertFalse(innerTask.get().isDone()); }); assertThreadCompleted(task); assertThreadCompleted(innerTask.get()); }