Interrupt.mesa
Copyright (C) Xerox Corporation 1981, 1982, 1983, 1984, 1985, 1986. All rights reserved.
last edited by Strickberger 19-Jul-85 1:25:43
Tim Diebert: October 3, 1986 2:02:59 pm PDT
DIRECTORY
PrincOpsUtils USING [AllocateNakedCondition, DeallocateNakedCondition],
Process USING [DisableTimeout, DisableAborts, EnableAborts, Milliseconds, MsecToTicks, SetTimeout];
Interrupt:
DEFINITIONS
LOCKS interrupt
USING interrupt: Handle
IMPORTS PrincOpsUtils, Process =
BEGIN
Constants:
maximumLapse: Process.Milliseconds = LAST[Process.Milliseconds];
Handle: TYPE = LONG POINTER TO Object;
Object: TYPE = MONITORED RECORD [condition: LONG POINTER TO CONDITION];
Finalize:
ENTRY
PROCEDURE [interrupt: Handle] =
INLINE BEGIN
ENABLE UNWIND => NULL;
PrincOpsUtils.DeallocateNakedCondition[cv: interrupt.condition];
RETURN;
END;
Initialize:
ENTRY
PROCEDURE [interrupt: Handle, enableAbort, enableTimeout:
BOOLEAN,
lapse: Process.Milliseconds ← maximumLapse]
RETURNS [mask:
WORD] =
INLINE BEGIN
ENABLE UNWIND => NULL;
[interrupt.condition, mask] ← PrincOpsUtils.AllocateNakedCondition[];
IF enableAbort
THEN Process.EnableAborts[pCondition: interrupt.condition]
ELSE Process.DisableAborts[pCondition: interrupt.condition];
IF enableTimeout
THEN Process.SetTimeout[condition: interrupt.condition, ticks: Process.MsecToTicks[lapse]]
ELSE Process.DisableTimeout[condition: interrupt.condition];
RETURN;
END;
Notify:
ENTRY
PROCEDURE [interrupt: Handle] =
INLINE BEGIN
ENABLE UNWIND => NULL; NOTIFY interrupt.condition^; RETURN; END;
Wait:
ENTRY
PROCEDURE [interrupt: Handle] =
INLINE BEGIN
ENABLE UNWIND => NULL; WAIT interrupt.condition^; RETURN; END;
END.
LOG
When / Who / What.
81/Claude Pany/Created.
11-Apr-83 15:54:00 - Trowell - created InterruptImpl and removed INLINEs here for Sierra compiler bug workaround.
10-Oct-83 3:32:02 - Strickberger - Restored INLINEs and deleted Impl. POINTER ← LONG POINTER for Klamth.
19-Jul-85 1:25:43 - Strickberger - Add copyright. FixArrows.