sclass PlanInMotion extends DynamicObject {
L doneSteps = synchroList();
L plannedSteps = synchroLinkedList();
volatile bool paused, cancelled;
*() {}
*(Iterable l) { addAll(plannedSteps, l); }
void add(A a) { plannedSteps.add(a); }
IterableIterator master() {
ret iteratorFromFunction(func -> A { master_next() });
}
A master_next() {
ret paused || cancelled ? null
: addAndReturnIfNotNull(doneSteps, syncPopFirst(plannedSteps));
}
}