GENERIC INTERFACECallback Stacks are monitored.CBStack (AnyCB); IMPORT CB, GO; TYPE T <: Public; Public = OBJECT METHODS init () : T; invokeTop (rec : AnyCB.Rec) RAISES {CB.BadMethod}; push (cb : AnyCB.T); pop () RAISES {GO.StackError}; remove (cb : AnyCB.T) RAISES {GO.StackError}; END;
push
, pop
, and remove
happen inside
the monitor. invokeTop
has two phases: obtaining the top element of the
stack (which happens inside the moditor), and invoking it (which is not
protected by the monitor).
END CBStack.