public void Schedule <T>(IScheduledEvent <T> args) where T : IEvent
        {
            if (args == null)
            {
                throw new ArgumentNullException(nameof(args));
            }

            var now  = this.app.GetTime();
            var item = new PriorityQueueItem <T>(this.app, args);

            item.MoveToNextOccurrence(now);
            if (now < item.Occurrence)
            {
                lock (this.queue)
                {
                    this.queue.Push(item);
                }
            }
        }
Esempio n. 2
0
 public void Push(PriorityQueueItem item)
 {
     this.queue.Add(item);
     this.BubbleUp(this.queue.Count - 1);
 }