DIRECTORY Rope ; CommTimer: CEDAR DEFINITIONS ~ { Timer: TYPE ~ REF TimerObject; TimerObject: TYPE; Event: TYPE ~ RECORD [ ref: REF EventObject, gen: CARD -- generation number, guarantees uniqueness ]; nullEvent: Event ~ [NIL, 0]; IsNullEvent: PROC [e: Event] RETURNS [BOOL] ~ INLINE { RETURN[e.ref = NIL] }; EventObject: TYPE; CreateTimer: PROC [grainSizeMsec: INT, expectedWaitMsec: INT] RETURNS [t: Timer]; DestroyTimer: PROC [t: Timer, doEvents: BOOL ¬ FALSE]; GrainSizeMsec: PROC [t: Timer] RETURNS [grainSizeMsec: INT]; MsecSinceCreated: PROC [t: Timer] RETURNS [msecSinceCreated: INT]; EventProc: TYPE ~ PROC [clientData: REF]; ScheduleEvent: PROC [t: Timer, waitMsec: INT, proc: EventProc, clientData: REF ¬ NIL] RETURNS [e: Event]; CancelEvent: PROC [t: Timer, e: Event]; MsecUntilOccurs: PROC [t: Timer, e: Event] RETURNS [msecUntilOccurs: INT]; Error: ERROR[codes: LIST OF ATOM, msg: Rope.ROPE]; }. F CommTimer.mesa Copyright Σ 1988, 1991 by Xerox Corporation. All rights reserved. Demers, October 9, 1990 5:04 pm PDT Timers and Events Timer Manipulation Create a timer with the given granularity, optimized for event waits of no more than the expected interval. Destroy a timer. It is expensive to drop one on the floor. If doEvents is TRUE, each pending event goes off as the timer is destroyed. Event Manipulation Proc to be called (at high priority) when an event occurs. It is the client's responsibility to ensure that this returns quickly, by doing a FORK and SetPriority if necessary. Arrange for proc[clientData] to be called at high priority after waitMsec has passed. Cancel a scheduled event. If the event has already occurred this is a no-op. Approximate. Errors Failures: $badGrainSize $staleEvent $staleTimer ... Κ<–(cedarcode) style•NewlineDelimiter ™code™Kšœ Οeœ7™BK™#K˜—šΟk ˜ K˜K˜K˜—šΟn œžœž œ˜ K˜head™Kšœžœžœ ˜šœ žœ˜K˜—šœžœžœ˜Kšœžœ ˜KšœžœΟc+˜6K˜—Kšœžœ˜KšŸ œžœ žœžœžœžœ žœ˜MKšœ žœ˜—™š Ÿ œžœžœžœžœ ˜QK™kK˜—šŸ œžœžœžœ˜6K™;K™KK˜—KšŸ œžœ žœžœ˜