System.Collections.Concurrent.BlockingCollection.Add(ResultContainer)

Here are the examples of the csharp api class System.Collections.Concurrent.BlockingCollection.Add(ResultContainer) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Example 7

1. Example

Project: LogMonitor
Source File: ChangeManager.cs
private void ProcessInput()
        {
            while (!this.cancellation.IsCancellationRequested)
            {
                Debug.WriteLine("Input queue: listening...");

                FileChange item = this.inputQueue.Take(this.cancellation.Token);
                Debug.WriteLine("Input queue: item received...");

                if (this.cancellation.IsCancellationRequested)
                    return;

                IProcessor[] matchingProcessors = this.processors
                    .Where(p => p.IsMatch(item.File))
                    .ToArray();

                Debug.WriteLine("Input queue: {0} matching processors.".FormatWith(matchingProcessors.Length));

                IEnumerable<Metric>[] metrics = new IEnumerable<Metric>[matchingProcessors.Length];

                Sequential.For(
                    0,
                    matchingProcessors.Length,
                    i => metrics[i] = matchingProcessors[i].ParseLine(item));

                this.outputQueue.Add(new ResultContainer
                {
                    Change = item,
                    Metrics = metrics.SelectMany(m => m).ToArray()
                });
                Debug.WriteLine("Input queue: item procesed.");
            }
        }