コード例 #1
0
ファイル: Barrier.cs プロジェクト: dox0/DotNet471RS3
        /// <summary>
        /// When overridden in a derived class, releases the unmanaged resources used by the
        /// <see cref="Barrier"/>, and optionally releases the managed resources.
        /// </summary>
        /// <param name="disposing">true to release both managed and unmanaged resources; false to release
        /// only unmanaged resources.</param>
        /// <remarks>
        /// Unlike most of the members of <see cref="Barrier"/>, Dispose is not thread-safe and may not be
        /// used concurrently with other members of this instance.
        /// </remarks>
        protected virtual void Dispose(bool disposing)
        {
            if (!m_disposed)
            {
                if (disposing)
                {
                    m_oddEvent.Dispose();
                    m_evenEvent.Dispose();
#if !PFX_LEGACY_3_5
                    if (m_ownerThreadContext != null)
                    {
                        m_ownerThreadContext.Dispose();
                        m_ownerThreadContext = null;
                    }
#endif
                }
                m_disposed = true;
            }
        }