ANY LOOP_ITEM NONE
class interface SIMPLE_PERIODIC_JOB
   -- Pseudo periodic job. The timing is not exact : the time between
   -- two execution may be longer than the given period depending on
   -- time needed to execute ready tasks. There is no try to recover the
   -- time lost each time.

creation
   set_work (t: FUNCTION[ANY,TUPLE,BOOLEAN]; tr: PROCEDURE[ANY,TUPLE]; prio: INTEGER; seconds: DOUBLE)
      -- t has to return True while continue
      require
         t /= Void;
         prio /= Minimum_integer;
         seconds > 0
      ensure
         priority = prio;
         period = seconds

feature(s) from PERIODIC_JOB
   period: DOUBLE
      -- unit is seconds

   next_time: MICROSECOND_TIME

feature(s) from SIMPLE_PERIODIC_JOB
   set_work (t: FUNCTION[ANY,TUPLE,BOOLEAN]; tr: PROCEDURE[ANY,TUPLE]; prio: INTEGER; seconds: DOUBLE)
      -- t has to return True while continue
      require
         t /= Void;
         prio /= Minimum_integer;
         seconds > 0
      ensure
         priority = prio;
         period = seconds


invariant

    period > 0;

    priority /= Minimum_integer;

end of SIMPLE_PERIODIC_JOB