Oberon || Library || Module Index || Search Engine || Definition || Module


Ulm's Oberon Library:
Timers


NAME

Timers - timer queues for clocks

SYNOPSIS

TYPE Timer = POINTER TO TimerRec;
TYPE TimerRec = RECORD (Objects.ObjectRec) END;


CONST invalidTimer = 0; (* timer is no longer valid *) CONST queueLocked = 1; (* the queue is currently locked *) CONST badClock = 2; (* clock is unable to maintain a timer *) CONST errorcodes = 3; TYPE ErrorEvent = POINTER TO ErrorEventRec; TYPE ErrorEventRec = RECORD (Events.EventRec) errorcode: SHORTINT; END; VAR errormsg: ARRAY errorcodes OF Events.Message; VAR error: Events.EventType;

PROCEDURE Add(clock: Clocks.Clock; time: Times.Time; event: Events.Event; VAR timer: Timer); PROCEDURE Remove(timer: Timer); PROCEDURE Schedule(clock: Clocks.Clock; time: Times.Time; event: Events.Event); PROCEDURE NextEvent(clock: Clocks.Clock; VAR time: Times.Time) : BOOLEAN;

DESCRIPTION

Timers maintains multiple timers for each clock. Add causes event to be raised at the given time. Relative time measures are taken relative to the current time. A reference to the timer is returned to allow the timer to be removed by Remove. Schedule works like Add but does not return a reference to the timer.

NextEvent returns the time of the next event in the queue of timers.

DIAGNOSTICS

Errors are related to the given clock and passed to RelatedEvents:
invalidTimer
An invalid timer was given to Remove. Timers become invalid if they have been dispatched or removed.
queueLocked
The timer queue of the clock is currently locked.
badClock
The given clock is unable to maintain a timer.

SEE ALSO

Clocks
general interface for clocks
Events
event handling
RelatedEvents
error handling
UnixClock
implementation of the system clock

Edited by: borchert, last change: 1992/03/24, revision: 1.2, converted to HTML: 1997/04/28

Oberon || Library || Module Index || Search Engine || Definition || Module