DIRECTORY DeviceCleanup USING [Item, Linkage, Reason], MPCodes USING [cleaningUp], PrincOps USING [FrameHandle, Port], PrincOpsUtils USING [ GetReturnFrame, GetReturnLink, MyLocalFrame, SetReturnLink], Process USING [InitializeMonitor], ProcessorFace USING [SetMP]; DeviceCleanupImpl: MONITOR IMPORTS PrincOpsUtils, Process, ProcessorFace EXPORTS DeviceCleanup SHARES DeviceCleanup = BEGIN linkage: PUBLIC DeviceCleanup.Linkage; InitializeDeviceCleanup: PUBLIC PROC = BEGIN reason: DeviceCleanup.Reason; pItem: POINTER TO Item; Process.InitializeMonitor[@LOCK]; -- because our main program is never executed pItemFirst _ NIL; LOOPHOLE[AwaitPerform, PrincOps.Port].dest _ PrincOpsUtils.GetReturnLink[]; linkage.Perform _ LOOPHOLE[@AwaitPerform]; DO linkage.Await _ LOOPHOLE[Install]; reason _ AwaitPerform[]; ProcessorFace.SetMP[MPCodes.cleaningUp]; linkage.Await _ LOOPHOLE[PrincOpsUtils.MyLocalFrame[]]; FOR pItem _ pItemFirst, pItem.pItemNext WHILE pItem ~= NIL DO [] _ pItem.Procedure[reason] -- value should be pItem ENDLOOP ENDLOOP END; AwaitPerform: PORT RETURNS [reason: DeviceCleanup.Reason]; Install: ENTRY PROC [pItem: POINTER TO Item] = BEGIN fCaller: PrincOps.FrameHandle = PrincOpsUtils.GetReturnFrame[]; -- cleanup procedure pItem^ _ [pItemNext: pItemFirst, Procedure: LOOPHOLE[fCaller]]; pItemFirst _ pItem; PrincOpsUtils.SetReturnLink[fCaller.returnlink] END; Item: PUBLIC TYPE = RECORD [ pItemNext: POINTER TO Item, Procedure: PROC [DeviceCleanup.Reason] RETURNS [POINTER TO Item] _ NULL]; pItemFirst: POINTER TO Item; -- list of waiting cleanup procedures END. zCedar Nucleus: device turn off/on during outload/inload DeviceCleanupImpl.mesa Andrew Birrell May 25, 1983 6:26 pm Κ3– "Cedar" style˜J™7J™J™$J˜šΟk ˜ Jšœœ˜,Jšœœ˜Jšœ œ˜#Jšœœ?˜RJšœœ˜"Jšœœ ˜—J˜šœ˜Jšœ&˜-Jšœ˜Jšœ˜—J˜Jš˜J˜Jšœ œ˜&J˜šΟnœœœ˜&Jš˜J˜Jšœœœ˜JšœœΟc-˜OJšœ œ˜JšœC˜KJšœœ˜*š˜Jšœœ ˜"J˜J˜(Jšœœ˜7šœ%œ œ˜=JšœŸ˜5Jš˜—Jš˜—Jšœ˜J˜—Jšœœœ ˜:J˜š žœœœ œœ˜.Jš˜Jšœ@Ÿ˜TJšœ,œ ˜?J˜J˜/Jšœ˜J˜—šœœœœ˜Jšœ œœ˜Jš ž œœœœœ œ˜I—J˜Jšœ œœŸ%˜BJ˜Jšœ˜J˜—…—8ε