예제 #1
0
        protected override void Dispose(bool disposing)
        {
            if (!Monitor.IsEntered(_disposeLock))
            {
                return;
            }

            try
            {
                if (disposing && !_disposed)
                {
                    _disposed = true;

                    if (!CancelationToken.IsCancellationRequested)
                    {
                        CancelationToken.Cancel();
                    }
                }
                base.Dispose(disposing);
            }
            finally
            {
                Monitor.Exit(_disposeLock);
            }
        }
예제 #2
0
        public void Stop()
        {
            CancelationToken.Cancel();

            foreach (var i in Connections)
            {
                i.Value.Stop();
            }
        }
예제 #3
0
        public void Dispose()
        {
            CancelationToken.Cancel();

            foreach (var chunk in Chunks.ToArray())
            {
                Chunks.TryRemove(chunk.Key, out IChunkColumn _);
                Enqueued.Remove(chunk.Key);
                chunk.Value.Dispose();
            }

            foreach (var data in _chunkData.ToArray())
            {
                _chunkData.TryRemove(data.Key, out _);
                data.Value?.Dispose();
            }

            _chunkData = null;
        }