-- File: [Indigo]<Sakura>Dragon>DragonClockImpl.sak
--  7-Mar-82 21:10:05

DIRECTORY
  DragonClock: TYPE, 
  SakuraRT: TYPE;

DragonClockImpl: MONITOR
  IMPORTS SakuraRT
  EXPORTS DragonClock
  
  = BEGIN
  ClockGenerator: PUBLIC PROC [ClockA, ClockB: SakuraRT.Handle] = {
    i: CARDINAL ← 0; 
    v: CARDINAL;
    {ENABLE {ABORTED => GO TO Aborted};
     DO SakuraRT.Put[ClockB, NEW[BOOLEAN ← FALSE]]; 
        SakuraRT.Put[ClockA, NEW[BOOLEAN ← TRUE]]; 
        SakuraRT.Delay[50]; 
        i ← i + 1; 
        v ← i * 50; 
        SakuraRT.Put[ClockA, NEW[BOOLEAN ← FALSE]]; 
        SakuraRT.Put[ClockB, NEW[BOOLEAN ← TRUE]]; 
        SakuraRT.Delay[50]; 
        i ← i + 1; 
        v ← i * 50
        ENDLOOP; 
     SakuraRT.ProcessEnd[]}
    EXITS
      Aborted => SakuraRT.Abort[]};
  
  END.