コード例 #1
0
 /// <summary>Dispose</summary>
 public void Dispose()
 {
     foreach (var j in this.jobStates)
     {
         Interlocked.Increment(ref this.validationQueued);
         if (j != null && j.RuleEngine != null)
         {
             ValidationJobQueue.EnqueueJob(j);
         }
     }
 }
コード例 #2
0
        /// <summary>Queue listener</summary>
        /// <param name="state">state</param>
        public static void ValidationQueueListener(object state)
        {
            while (true)
            {
                // blocks until there is an item to dequeue
                var jobState = ValidationJobQueue.DequeueJob();

                if (jobState != null)
                {
                    // enter semaphore
                    workerPool.WaitOne();
                    ThreadPool.QueueUserWorkItem(new WaitCallback(ValidationJobWorker), jobState);
                }
            }
        }