/// <remarks> /// <b>Relative Scheduling</b> /// <tt>true</tt>:<br></br> /// Task is rescheduled relative to the last time it <i>actually</i> /// started execution /// <p> /// <tt>false</tt>:<br></br> /// Task is scheduled relative to its <i>last</i> execution schedule. This /// has the effect that the time between two consecutive executions of /// the task remains the same. /// </p> /// </remarks> /// <summary> /// Add a task for execution at adjustable intervals /// </summary> /// <param name="t">The task to execute</param> /// <param name="relative">Use relative scheduling</param> public void add(Task t, bool relative) { long interval, sched; if ((interval = t.nextInterval()) < 0) return; sched = System.Environment.TickCount + interval; lock(queue) { queue.add(new IntTask(t, sched, relative)); switch(thread_state) { case RUN: Monitor.PulseAll(queue); break; case SUSPEND: _unsuspend(); break; case STOPPING: break; case STOP: break; } } }