// ///////////////////////////////////////////////////////////////////////////////// /// <summary> /// Construct a Scheduler with the specified callback method, and number of /// milliseconds between each callback. /// </summary> /// <param name="callback"></param> /// <param name="delayMS"></param> public Schedule(ScheduleCallback callback, uint delayMS) { if (callback == null) { throw new ArgumentNullException("callback"); } Callback = callback; DelayMS = delayMS; }
public void Schedule(ScheduleCallback callback) { if (callback == null) { throw new ArgumentNullException("callback"); } unsafe { BlockLiteral *block_ptr_handler; BlockLiteral block_handler; block_handler = new BlockLiteral(); block_ptr_handler = &block_handler; block_handler.SetupBlockUnsafe(static_handler, callback); //NativePInvoke((void*)block_ptr_handler); SetupHandler(block_ptr_handler); block_ptr_handler->CleanupBlock(); } }
public int Schedule(TimeSpan delay, bool repeating, ScheduleCallback callback, object state) { if (callback == null) { throw new ArgumentNullException("callback"); } delay = TimeSpan.FromTicks(Math.Max(MinDelay.Ticks, Math.Min(MaxDelay.Ticks, delay.Ticks))); ScheduleEvent scheduleEvent = _pool.Acquire(); scheduleEvent.Id = _eventSequence++; scheduleEvent.Delay = delay; scheduleEvent.StartTime = _timeNow; scheduleEvent.Repeat = repeating; scheduleEvent.Cancelled = false; scheduleEvent.Callback = callback; scheduleEvent.State = state; _heap.Add(scheduleEvent); _lookup.Add(scheduleEvent.Id, scheduleEvent); return(scheduleEvent.Id); }