!7 set flag LeanMode. 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; //enableScaffolding(schedule); schedule.add(0, r { print("on"); on.set(); }); schedule.add(coresToUse, r { print("off"); on.unset(); }); 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 " + i); } } } schedule.run(); }