Warning: session_start(): open(/var/lib/php/sessions/sess_b82o989oni9lg3p0m7l3vrqmla, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
srecord noeq StupidFib_collab(ICollab collab, int n) {
double timeout = 10.0;
// if n <= parallelizationThreshold, we calculate serially
gettable int parallelizationThreshold = 8;
settable int delay = 0; // millisecond delay per add
selfType parallelizationThreshold(int x) {
parallelizationThreshold = max(3, x); this;
}
record noeq Step(int n, LongConsumer continuation) is Runnable {
run {
if (n < parallelizationThreshold)
ret with continuation.accept(stupidFib_collab(n));
LongPairCollector collector = new {
void complete(long a, long b) {
continuation.accept(add(a, b));
}
};
collab.addWork(new Step(n-1, collector.setterForA()));
collab.addWork(new Step(n-2, collector.setterForB()));
}
}
long get() {
new Var var;
collab.addWork(new Step(n, result -> {
var.set(result);
collab.done();
}));
collab.run();
ret waitForVarToBeNotNullWithTimeout(var, secondsToMS_int(timeout));
}
long add(long a, long b) {
if (delay > 0) sleep(delay);
ret a+b;
}
}