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


Ulm's Oberon Library:
TimeConditions


NAME

TimeConditions - conditions which allow to wait for a given time

SYNOPSIS

TYPE Condition = POINTER TO ConditionRec;
TYPE ConditionRec = RECORD (Conditions.ConditionRec) END;
PROCEDURE Create(VAR condition: Conditions.Condition;
                 clock: Clocks.Clock; time: Times.Time);
PROCEDURE Init(condition: Condition; clock: Clocks.Clock; time: Times.Time);

DESCRIPTION

TimeConditions allows to specify time conditions, i.e. conditions which yield TRUE if the current time of a given clock is equal to or past a given time.

Create creates and returns condition which evaluates to TRUE if the current time of clock is greater than or equal to time. Relative time measures are interpreted relative to the current time of the given clock at creation of the time condition. Once a time condition becomes true for the first time, it remains true even if the clock has been set back afterwards.

In case of an extended type of Condition, Init can be used instead of Create.

EXAMPLE

The procedure following shows how to delay the current task for a given number of seconds:
PROCEDURE Delay(seconds: INTEGER);
   VAR
      time: Times.Time;
      condition: Conditions.Condition;
BEGIN
   Times.CreateAndSet(time, Times.relative, 0, seconds, 0);
   TimeConditions.Create(condition, Clocks.system, time);
   Tasks.WaitFor(condition);
END Delay;

DIAGNOSTICS

TimeConditions forwards (temporarily) error events of the clock to the errors parameter of the interface procedures of Conditions. Further, a task or process suspension is cancelled in such cases.

SEE ALSO

Clocks
clock interface
Conditions
interface for conditions
Tasks
general task management
Times
representations of time values

Edited by: borchert, last change: 2004/02/19, revision: 1.5, converted to HTML: 2004/02/19

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