/// <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); } } }
/// <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); } } }