RollbackImpl.mesa
Last Edited by: Swinehart, September 16, 1985 9:50:20 am PDT
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: BOOLTRUE;
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];
}.