예제 #1
0
 private static void Process()
 {
     while (true)
     {
         if (shutdown)
         {
             return;
         }
         InstantMeterQueueItem item = null;
         lock (sync)
         {
             if (queue.Count > 0)
             {
                 item = queue.Dequeue();
             }
         }
         if (item != null)
         {
             DispatchItem(item);
         }
         else
         {
             pass.WaitOne();
         }
     }
 }
예제 #2
0
        public static void IncrementCounter(string resourceName, double incrementValue)
        {
            InstantMeterQueueItem item = new InstantMeterQueueItem
            {
                IncrementValue = incrementValue,
                ResourceName   = resourceName,
                Time           = DateTime.Now
            };

            lock (sync)
            {
                queue.Enqueue(item);
                pass.Set();
            }
        }
예제 #3
0
 private static void DispatchItem(InstantMeterQueueItem item)
 {
     IncrementCounterPrivate(item.ResourceName, item.IncrementValue, item.Time);
 }