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

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

2 Examples 7

1. Example

Project: JavaScriptViewEngine
Source File: RenderEnginePool.cs
private void PopulateEngines()
        {
            while (EngineCount < _options.StartEngines)
            {
                var engine = CreateEngine();
                _availableEngines.Add(engine);
            }
        }

2. Example

Project: JavaScriptViewEngine
Source File: RenderEnginePool.cs
public virtual void ReturnEngineToPool(IRenderEngine engine)
        {
            if (!_metadata.ContainsKey(engine))
            {
                // This engine was from another pool. This could happen if a pool is recycled
                // and replaced with a different one. Let's just pretend we never saw it.
                engine.Dispose();
                return;
            }

            _metadata[engine].InUse = false;
            var usageCount = _metadata[engine].UsageCount;
            if (_options.MaxUsagesPerEngine > 0 && usageCount >= _options.MaxUsagesPerEngine)
            {
                // Engine has been reused the maximum number of times, recycle it.
                DisposeEngine(engine);
                return;
            }
            
            _availableEngines.Add(engine);
        }