Пример #1
0
        public void Dispose()
        {
            Release();

            if (_event != null)
            {
                _event.Dispose();
                _event = null;
            }
        }
Пример #2
0
        private void Dispose(bool disposing)
        {
            _disposed = true;
            if (disposing)
            {
                _queueAddEvent.Set();
                _queueReturnEvent.Set();

                if (CleanupPoolOnDispose && typeof(IDisposable).IsAssignableFrom(typeof(T)))
                {
                    while (!_objectPool.IsEmpty)
                    {
                        ((IDisposable)_objectPool.Dequeue()).Dispose();
                    }
                }

                _objectPool.Dispose();
                _queueAddEvent.Dispose();
                _queueReturnEvent.Dispose();
                _disposeLock.Dispose();
            }
        }