sclass ReliableSingleThread_Multi {
IVF1 processObject;
int delay; // delay before changes are processed
*(IVF1 *processObject) {}
*(int *delay, IVF1 *processObject) {}
*(int *delay, IVF1 *processObject, F0 enter) { setEnter(enter); }
// internal
Set changedObjects = synchroSet();
ReliableSingleThread rst = new(r process);
// notify of change in object
void add(A a) {
if (changedObjects.add(a))
rst.trigger();
}
void addAll(Iterable l) {
fOr ping (A a : l) add(a);
}
private void process {
sleep(delay);
for ping (A object : syncCloneAndClearList(changedObjects))
pcallF(processObject, object);
}
void setEnter(F0 enter) {
rst.enter = enter;
}
}