Ejemplo n.º 1
0
        public SchedulerEntry(ApproximateDateBlock dateBlock)
        {
            if (dateBlock == null)
            {
                throw new ArgumentNullException();
            }

            _dateBlock = dateBlock;
            _dateBlock.DateUpdated += _dateBlock_DateUpdated;
            _cachedUpdateTime = dateBlock.NextUpdate;
        }
Ejemplo n.º 2
0
 public static void Unregister(ApproximateDateBlock dateBlock)
 {
     lock (typeof(InOrderScheduler))
     {
         if (_instance == null) _instance = new InOrderScheduler();
     }
     Task.Run(new Action(() =>
     {
         _instance.InternalUnregister(dateBlock);
     }));
 }
Ejemplo n.º 3
0
 private void InternalRegister(ApproximateDateBlock dateBlock)
 {
     lock (this)
     {
         CancelCurrentUpdate();
         SchedulerEntry schedulerEntry = new SchedulerEntry(dateBlock);
         schedulerEntry.DateUpdated += OnDateUpdated;
         _set.Add(schedulerEntry.CachedNextUpdate, schedulerEntry);
         _lookupDict.Add(dateBlock, schedulerEntry);
         ScheduleNextUpdate();
     }
 }
Ejemplo n.º 4
0
 private void InternalUnregister(ApproximateDateBlock dateBlock)
 {
     SchedulerEntry schedulerEntry;
     lock (this)
     {
         if (_lookupDict.TryGetValue(dateBlock, out schedulerEntry))
         {
             CancelCurrentUpdate();
             _lookupDict.Remove(dateBlock);
             _set.Remove(schedulerEntry);
             ScheduleNextUpdate();
         }
     }
 }