예제 #1
0
        private static void Enqueue(LinkedList <Task> Queue, WaitCallback callback, object state)
        {
            itemsInQueue.Increment();
            lock (lockAllQueue)
            {
                Queue.AddLast(new Task(callback, state));
            }

            System.Threading.ThreadPool.QueueUserWorkItem(RunPriorityQueue);
        }
예제 #2
0
 public void OnProcessSucceeded(object sender, Wammer.Station.HttpHandlerEventArgs evt)
 {
     try
     {
         avgTime.IncrementBy(evt.DurationInTicks);
         avgTimeBase.Increment();
     }
     catch (Exception e)
     {
         Logger.Warn("Unable to write performance data: " + PerfCounter.AVG_TIME_PER_ATTACHMENT_UPLOAD, e);
     }
 }
예제 #3
0
 public static void RunPriorityQueue(object nil)
 {
     try
     {
         Task task = Dequeue();
         itemsInProgress.Increment();
         task.Execute(null);
     }
     catch (Exception e)
     {
         Logger.Warn("Error while task execution", e);
     }
     finally
     {
         itemsInProgress.Decrement();
     }
 }