DIRECTORY
Atom USING [ MakeAtom ],
Booting USING [ RegisterProcs, CheckpointProc ],
FinchSmarts USING [ PlayNoise ],
Process USING [ Detach, MsecToTicks, Pause ],
UserProfile USING [ Token ]
;
RollbackImpl:
CEDAR
PROGRAM
IMPORTS
Atom, Booting, FinchSmarts, Process, UserProfile
= {
reallyBoot: BOOL←TRUE;
didOurBest: BOOL;
maxTime: CARDINAL ← 4000;
PlayTheRollbackButton: Booting.CheckpointProc =
TRUSTED {
PlayAButton[$rollback];
IF ~reallyBoot THEN rejection ← "Just pretending";
};
PlayAButton:
PROC[name:
ATOM] =
TRUSTED {
didOurBest ← FALSE;
Process.Detach[FORK ReallyPlayAButton[name]];
FOR i:
NAT
IN [0..100)
DO
Process.Pause[Process.MsecToTicks[maxTime/100]];
IF didOurBest THEN EXIT;
ENDLOOP;
};
ReallyPlayAButton:
PROC[name:
ATOM] = {
[]𡤏inchSmarts.PlayNoise[noiseName: name, wait: TRUE];
didOurBest ← TRUE;
};
IF Atom.MakeAtom[UserProfile.Token["Finch.NoisyBoot", "FALSE"]] = $TRUE
THEN
Booting.RegisterProcs[c: PlayTheRollbackButton, r: NIL, b: PlayTheRollbackButton];
}.