예제 #1
0
 /// <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)));
 }
예제 #2
0
 /// <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));
 }
예제 #3
0
 /// <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)));
 }
예제 #4
0
 public TaskContext(Task task, TaskScheduler owner)
 {
     _task     = task;
     _owner    = owner;
     _consumed = false;
 }