From 48f168fb1a6e45986d1a3a934282fd1baff4fa0d Mon Sep 17 00:00:00 2001 From: schodet Date: Sun, 6 Mar 2005 17:22:53 +0000 Subject: Utilisation de Timer, correction de bugs. --- 2005/i/robert/src/scheduler/schedulable_alarm.hh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to '2005/i/robert/src/scheduler/schedulable_alarm.hh') diff --git a/2005/i/robert/src/scheduler/schedulable_alarm.hh b/2005/i/robert/src/scheduler/schedulable_alarm.hh index f416d12..1e008b6 100644 --- a/2005/i/robert/src/scheduler/schedulable_alarm.hh +++ b/2005/i/robert/src/scheduler/schedulable_alarm.hh @@ -25,6 +25,7 @@ // }}} #include "schedulable.hh" #include "utils/callback.hh" +#include "timer/timer.hh" namespace scheduler { @@ -35,12 +36,18 @@ class SchedulableAlarm : public Schedulable int start_, step_; bool periodic_; public: - /// Constructeur. + /// Construit une alarm dans step milliseconde, périodique si periodic est + /// vrai (vrai par defaut), à partir de start si donné, ou de maintenant + /// sinon. template - SchedulableAlarm (T callback, int start, int step, bool periodic = true) + SchedulableAlarm (T callback, int step, bool periodic = true, + int start = -1) : callback_ (callback), start_ (start), step_ (step), periodic_ (periodic) - { } + { + if (start_ == -1) + start_ = Timer::getProgramTime (); + } /// Paramètre le Scheduler. void setup (Scheduler &scheduler, int time, FdSet &readSet, int &timeout); /// Appelé aprés l'attente du Scheduler, renvois true si un événement a -- cgit v1.2.3