!7 static double coresToUse = .5; static new BoolVar on; static volatile long result; static NotTooOften nto = nto(1.0); p-exp { // exp for "experiment" automatically reloads on updates new Schedule schedule; schedule.add(0, r { set on; }); schedule.add(coresToUse, r { unset on; }); schedule.jumpFromTo(1, 0); schedule.speedUp(10); thread { long i = 0; while (ping) true { if (on!) ++i; else { result = i; on.waitUntilTrue(); if (nto!) print("I have counted until " + n2); } } } schedule.run(); }