AbortLockTest.Mesa
Spreitzer, August 28, 1985 10:19:13 pm PDT
JKF January 11, 1989 10:06:07 am PST
DIRECTORY
Process USING [ConditionPointer, EnableAborts, InitializeCondition, SecondsToTicks];
AbortLockTest: CEDAR MONITOR
IMPORTS Process =
BEGIN
change: CONDITION;
wait: BOOLFALSE;
unwinds: ARRAY Where OF BOOLALL[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.