Warning: session_start(): open(/var/lib/php/sessions/sess_jiie973du3u187qe4ddmidlfbb, 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
!7
p-experiment {
print("Result: "+ callHibernatable(f serve, f reversedString));
}
sclass HibernationFuture {
new Flag done;
O value;
Runnable continuation;
void setContinuation(Runnable r) {
synchronized(done) {
if (!done.isUp()) ret with continuation = r;
}
callF(r);
}
void setValue(O value) {
synchronized(done) {
if (done.isUp()) fail("setValue called twice");
this.value = value;
done.raise();
}
callF(continuation);
}
}
static O callHibernatable(O f1, O f2) {
O result;
try {
result = callF(f1);
} catch (RuntimeException e) {
Throwable e2 = innerException(e);
if (!e2 instanceof HibernatingTheThread) throw rethrow(e);
HibernatingTheThread h = cast e2;
}
ret callF(f2, result);
}
svoid normalFunction1() {
print("finished");
}
svoid hibernatingFunction1() {
HibernatingTheThread e = new(r { print("finished after hibernation"); });
doLater(1000, e);
throw e;
}
sS aFunction(bool hibernate) {
if (hibernate) {
print("Hibernating for 1s...");
HibernatingTheThread e = new(func -> S {
ret "finished";
});
doLater(1000, e);
throw e;
} else
ret "hello";
}
sclass HibernatingTheThread extends QuickException implements Runnable {
HibernationFuture future;
Flag done;
O code; // runnable or F0
O continuation; // runnable or vf1
*() {}
*(O *code) {}
public void run() {
callF(continuation, callF(code));
}
}