System.Collections.Concurrent.BlockingCollection.Dispose(bool)

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

25 Examples 7

1. Example

Project: orleans
Source File: ProxiedMessageCenter.cs
public void Dispose()
        {
            PendingInboundMessages.Dispose();
            if (gatewayConnections != null)
                foreach (var item in gatewayConnections)
                {
                    item.Value.Dispose();
                }
            GatewayManager.Dispose();
        }

2. Example

Project: orleans
Source File: WorkQueue.cs
public void Dispose()
        {
            queueArray = null;

            if (mainQueue != null)
            {
                mainQueue.Dispose();
                mainQueue = null;
            }

            if (systemQueue != null)
            {
                systemQueue.Dispose();
                systemQueue = null;
            }

            GC.SuppressFinalize(this);
        }

3. Example

Project: netcorecli-fsc
Source File: BlockingMemoryStream.cs
protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                _buffers.Dispose();
            }

            base.Dispose(disposing);
        }

4. Example

Project: cli
Source File: BlockingMemoryStream.cs
protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                _buffers.Dispose();
            }

            base.Dispose(disposing);
        }

5. Example

Project: roslyn-tools
Source File: SingleThreadSynchronizationContext.cs
public void Dispose()
        {
            queue.Dispose();
        }

6. Example

Project: referencesource
Source File: BlockingCollection.cs
public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }

7. Example

Project: DbgShell
Source File: BlockingCollectionHolder.cs
public void Dispose()
        {
            BlockingCollection< T > local;
            lock( m_syncRoot )
            {
                local = m_bc;
                m_bc = null;
            }
            if( null != local )
            {
                // We might be disposing of this on some exception path, so give the
                // producer a chance to know that they should stop producing by
                // signaling the CancelToken.
                m_localCts.Cancel();
                local.Dispose();
            }
        }

8. Example

Project: DbgShell
Source File: DbgEngThread.cs
internal void ResetQ()
            {
                Util.Assert( !m_disposed );
                Util.Assert( m_q.IsCompleted );

                m_q.Dispose();
                m_q = new BlockingCollection< Action >();

                // Maybe this isn't a program invariant... but I'm not expecting windbg to
                // switch threads on me.
                Util.Assert( m_dbgEngThread == Thread.CurrentThread );
            }

9. Example

Project: DbgShell
Source File: DbgEngThread.cs
public void Dispose()
            {
                lock( m_syncRoot )
                {
                    if( m_disposed )
                        return;

                    m_disposed = true;
                }

                m_q.Dispose();
            }

10. Example

Project: Orleans.Indexing
Source File: ProxiedMessageCenter.cs
public void Dispose()
        {
            PendingInboundMessages.Dispose();
            if (gatewayConnections != null)
                foreach (var item in gatewayConnections)
                {
                    item.Value.Dispose();
                }
            GatewayManager.Dispose();
        }

11. Example

Project: Orleans.Indexing
Source File: AsynchQueueAgent.cs
protected override void Dispose(bool disposing)
        {
            if (!disposing) return;
            
#if TRACK_DETAILED_STATS
            if (StatisticsCollector.CollectThreadTimeTrackingStats)
            {
                threadTracking.OnStopExecution();
            }
#endif
            base.Dispose(disposing);

            if (requestQueue != null)
            {
                requestQueue.Dispose();
                requestQueue = null;
            }
        }

12. Example

Project: Orleans.Indexing
Source File: WorkQueue.cs
public void Dispose()
        {
            queueArray = null;

            if (mainQueue != null)
            {
                mainQueue.Dispose();
                mainQueue = null;
            }

            if (systemQueue != null)
            {
                systemQueue.Dispose();
                systemQueue = null;
            }

            GC.SuppressFinalize(this);
        }

13. Example

Project: azure-storage-net-data-movement
Source File: TaskQueue.cs
protected virtual void Dispose(bool disposing)
        {
            if (!disposedValue)
            {
                if (disposing)
                {
                    this.queue.Dispose();
                    this.queue = null;
                }

                disposedValue = true;
            }
        }

14. Example

Project: StackExchange.Precompilation
Source File: RazorParser.cs
void IDisposable.Dispose()
        {
            _workItems?.Dispose();
        }

15. Example

Project: AsyncEx
Source File: AsyncContext.TaskQueue.cs
public void Dispose()
            {
                _queue.Dispose();
            }

16. Example

Project: roslyn
Source File: StaTaskScheduler.cs
public void Dispose()
        {
            if (_tasks != null)
            {
                // Indicate that no new tasks will be coming in
                _tasks.CompleteAdding();

                // Wait for all threads to finish processing tasks
                foreach (var thread in _threads)
                    thread.Join();

                // Cleanup
                _tasks.Dispose();
                _tasks = null;
            }
        }

17. Example

Project: interactive-window
Source File: StaTaskScheduler.cs
public void Dispose()
        {
            if (_tasks != null)
            {
                // Indicate that no new tasks will be coming in
                _tasks.CompleteAdding();

                // Wait for all threads to finish processing tasks
                foreach (var thread in _threads)
                    thread.Join();

                // Cleanup
                _tasks.Dispose();
                _tasks = null;
            }
        }

18. Example

Project: PdfReport
Source File: ParallelTasksQueue.cs
protected virtual void Dispose(bool disposeManagedResources)
        {
            if (_disposed) return;
            if (!disposeManagedResources) return;

            if (_tasks != null)
            {
                _tasks.CompleteAdding();

                foreach (var thread in _threads) thread.Join();

                _tasks.Dispose();
                _tasks = null;
            }

            _disposed = true;
        }

19. Example

Project: GitHubFolderDownloader
Source File: ParallelTasksQueue.cs
protected virtual void Dispose(bool disposeManagedResources)
        {
            if (_disposed) return;
            if (!disposeManagedResources) return;

            if (_tasks != null)
            {
                _tasks.CompleteAdding();

                foreach (var thread in _threads) thread.Join();

                _tasks.Dispose();
                _tasks = null;
            }

            _disposed = true;
        }

20. Example

Project: Craig-s-Utility-Library
Source File: TaskQueue.cs
protected override void Dispose(bool disposing)
        {
            if (Tasks != null)
            {
                Cancel(true);
                foreach (Task Task in Tasks)
                {
                    Task.Dispose();
                }
                Tasks = null;
            }
            if (CancellationToken != null)
            {
                CancellationToken.Dispose();
                CancellationToken = null;
            }
            base.Dispose(disposing);
        }

21. Example

Project: Craig-s-Utility-Library
Source File: TaskQueue.cs
protected override void Dispose(bool disposing)
        {
            if (Tasks != null)
            {
                Cancel(true);
                foreach (Task Task in Tasks)
                {
                    Task.Dispose();
                }
                Tasks = null;
            }
            if (CancellationToken != null)
            {
                CancellationToken.Dispose();
                CancellationToken = null;
            }
            base.Dispose(disposing);
        }

22. Example

Project: DbgShell
Source File: DbgBaseCommand.cs
public void Run()
            {
                if( (null == m_q) || m_q.IsCompleted )
                    throw new InvalidOperationException( "You must call Prepare() before calling Run()." );

                foreach( Action action in m_q.GetConsumingEnumerable() )
                {
                    // We do not exit early if cancellation has been requested, because
                    // actions may need to be run during cancellation.
                    m_cmdlet.IgnorePipelineStopped( action );
                }
                m_actionQueue.Dispose();
                m_q.Dispose();
                m_q = null;
            }

23. Example

Project: Cognitive-Samples-VideoFrameAnalysis
Source File: FrameGrabber.cs
public async Task StopProcessingAsync()
        {
            OnProcessingStopping();

            _stopping = true;
            _frameGrabTimer.Set();
            if (_producerTask != null)
            {
                await _producerTask;
                _producerTask = null;
            }
            if (_consumerTask != null)
            {
                await _consumerTask;
                _consumerTask = null;
            }
            if (_analysisTaskQueue != null)
            {
                _analysisTaskQueue.Dispose();
                _analysisTaskQueue = null;
            }
            _stopping = false;

            OnProcessingStopped();
        }

24. Example

Project: azure-storage-net-data-movement
Source File: TransferScheduler.cs
private void Dispose(bool disposing)
        {
            if (!this.isDisposed)
            {
                lock (this.disposeLock)
                {
                    // We got the lock, isDisposed is true, means that the disposing has been finished.
                    if (this.isDisposed)
                    {
                        return;
                    }

                    this.isDisposed = true;

                    this.CancelWork();
                    this.WaitForCompletion();

                    if (disposing)
                    {
                        if (null != this.controllerQueue)
                        {
                            this.controllerQueue.Dispose();
                            this.controllerQueue = null;
                        }

                        if (null != this.cancellationTokenSource)
                        {
                            this.cancellationTokenSource.Dispose();
                            this.cancellationTokenSource = null;
                        }

                        if (null != this.controllerResetEvent)
                        {
                            this.controllerResetEvent.Dispose();
                            this.controllerResetEvent = null;
                        }

                        this.memoryManager = null;
                    }
                }
            }
            else
            {
                this.WaitForCompletion();
            }
        }

25. Example

Project: diagnostics-eventflow
Source File: CsvHealthReporter.cs
private void ConsumeCollectedData()
        {
            foreach (string text in this.reportCollect/n ..... /n //View Source file for more details /n }