Dispose() public méthode

Releases all the resources used by the PageReplacementAlgorithm object.
public Dispose ( ) : void
Résultat void
Exemple #1
0
        /// <summary>
        /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
        /// </summary>
        /// <filterpriority>2</filterpriority>
        public void Dispose()
        {
            if (!m_disposed)
            {
                try
                {
                    m_disposed = true;
                    //Unregistering from this event gaurentees that a collection will no longer
                    //be called since this class utilizes custom code to garentee this.
                    m_pool.RequestCollection -= m_pool_RequestCollection;

                    lock (m_syncRoot)
                    {
                        if (m_pageReplacementAlgorithm != null)
                        {
                            m_pageReplacementAlgorithm.Dispose();
                        }
                        if (m_queue != null)
                        {
                            m_queue.Dispose();
                        }
                        if (m_writeBuffer != null)
                        {
                            m_writeBuffer.Dispose();
                        }
                    }
                }
                finally
                {
                    m_queue    = null;
                    m_disposed = true;
                    m_pageReplacementAlgorithm = null;
                    m_writeBuffer = null;
                    m_queue       = null;
                    GC.SuppressFinalize(this);
                }
            }
        }