AbortLockTest.Mesa
Spreitzer, August 28, 1985 10:19:13 pm PDT
DIRECTORY Process;
AbortLockTest:
CEDAR
MONITOR
IMPORTS Process =
BEGIN
change: CONDITION;
wait: BOOL ← FALSE;
unwinds: ARRAY Where OF BOOL ← ALL[FALSE];
Where: TYPE = {inner, inside, call};
OuterReEnter:
PROC [x:
NAT] = {
ENABLE UNWIND => EnterAndSet[x];
Enter[];
};
OuterEnter:
PROC = {
Enter[!UNWIND => unwinds[call] ← TRUE];
};
Enter:
ENTRY
PROC = {
ENABLE UNWIND => {unwinds[inside] ← TRUE};
Inner[];
};
Inner:
INTERNAL
PROC = {
ENABLE UNWIND => {unwinds[inner] ← TRUE};
WHILE wait DO WAIT change ENDLOOP;
};
EnterAndSet: ENTRY PROC [x: NAT] = {memory ← x};
memory: NAT ← 0;
Start:
PROC =
TRUSTED {
cp: Process.ConditionPointer = @change;
Process.InitializeCondition[cp, Process.SecondsToTicks[15]];
Process.EnableAborts[cp];
};
Start[];
END.