/// <summary> /// Reschedule all tasks of a group with a random duration between min and max. /// </summary> /// <param name="group"></param> /// <param name="min"></param> /// <param name="max"></param> /// <returns></returns> public TaskContext RescheduleGroup(uint group, TimeSpan min, TimeSpan max) { return(RescheduleGroup(group, TaskScheduler.RandomDurationBetween(min, max))); }
/// <summary> /// Schedule an event with a randomized rate between min and max rate from within the context. /// Its possible that the new event is executed immediately! /// Use TaskScheduler.Async to create a task /// which will be called at the next update tick. /// </summary> /// <param name="min"></param> /// <param name="max"></param> /// <param name="group"></param> /// <param name="task"></param> /// <returns></returns> public TaskContext Schedule(TimeSpan min, TimeSpan max, uint group, Action <TaskContext> task) { return(Schedule(TaskScheduler.RandomDurationBetween(min, max), group, task)); }
/// <summary> /// Reschedule all tasks with a random duration between min and max. /// </summary> /// <param name="min"></param> /// <param name="max"></param> /// <returns></returns> public TaskContext RescheduleAll(TimeSpan min, TimeSpan max) { return(RescheduleAll(TaskScheduler.RandomDurationBetween(min, max))); }
public TaskContext(Task task, TaskScheduler owner) { _task = task; _owner = owner; _consumed = false; }