示例#1
0
 private static void InvokeCallBack()
 {
     if (_scheduleItems.Count > 0)
     {
         lock (_scheduleItems.SyncRoot)
         {
             if (_scheduleItems.Count > 0)
             {
                 DateTime now = DateTime.Now;
                 for (int i = 0; i < _scheduleItems.Count; i++)
                 {
                     try
                     {
                         ScheduledItem state = _scheduleItems[i] as ScheduledItem;
                         if (state != null)
                         {
                             state.SetCheckTime(now);
                             WorkThread.QueueItem(new WaitCallback(Schedule.InvokeCallBackItem), state);
                         }
                     }
                     catch
                     {
                     }
                 }
             }
         }
     }
 }
示例#2
0
 internal void InvokeCallBack()
 {
     if (this._callBack != null)
     {
         WorkThread.QueueItem(new WaitCallback(this._callBack.Invoke), this._checkedTime);
     }
 }
示例#3
0
 protected virtual void Check()
 {
     if (!this._checking)
     {
         try
         {
             lock (this)
             {
                 if (this._checking)
                 {
                     return;
                 }
                 this._checking = true;
             }
             int index = 0;
             lock (this._items.SyncRoot)
             {
                 while (index < this._items.Count)
                 {
                     if (this._items[index] == null)
                     {
                         this._items.RemoveAt(index);
                     }
                     else
                     {
                         WeakReference state = this._items[index] as WeakReference;
                         if ((state == null) || !state.IsAlive)
                         {
                             this._items.RemoveAt(index);
                             continue;
                         }
                         IReleasable target = state.Target as IReleasable;
                         if ((target == null) || target.IsExpired)
                         {
                             this._items.RemoveAt(index);
                             WorkThread.QueueItem(new WaitCallback(this.ReleaseItem), state);
                             continue;
                         }
                         index++;
                     }
                 }
             }
         }
         finally
         {
             this._checking = false;
         }
     }
 }
 private static void InvokeCallBack(object state)
 {
     if (__intervalTable.Count > 0)
     {
         lock (typeof(Interval))
         {
             if (__intervalTable.Count > 0)
             {
                 foreach (object obj2 in __intervalTable.Keys)
                 {
                     try
                     {
                         Interval interval = __intervalTable[obj2] as Interval;
                         if (interval != null)
                         {
                             if (interval._item.IsExpired)
                             {
                                 try
                                 {
                                     WorkThread.QueueItem(new WaitCallback(Interval.CallBackList), interval._item.CallBackList);
                                     continue;
                                 }
                                 catch
                                 {
                                     continue;
                                 }
                                 finally
                                 {
                                     interval._item.Reset();
                                 }
                             }
                             interval._item.Increment();
                         }
                         continue;
                     }
                     catch
                     {
                         continue;
                     }
                 }
             }
         }
     }
 }