InterlockedFree() static private method

static private InterlockedFree ( OverlappedCache &overlappedCache ) : void
overlappedCache OverlappedCache
return void
 protected virtual void ForceReleaseUnmanagedStructures()
 {
     this.ReleaseGCHandles();
     GC.SuppressFinalize(this);
     if ((this.m_UnmanagedBlob != null) && !this.m_UnmanagedBlob.IsInvalid)
     {
         this.m_UnmanagedBlob.Close(true);
         this.m_UnmanagedBlob = null;
     }
     OverlappedCache.InterlockedFree(ref this.m_Cache);
     if (this.m_OverlappedEvent != null)
     {
         this.m_OverlappedEvent.Close();
         this.m_OverlappedEvent = null;
     }
 }
Esempio n. 2
0
        // Utility cleanup routine. Frees the overlapped structure.
        // This should be overriden to free pinned and unmanaged memory in the subclass.
        // It needs to also be invoked from the subclass.
        protected virtual void ForceReleaseUnmanagedStructures()
        {
            //
            // free the unmanaged memory if allocated.
            //
            ReleaseGCHandles();
            GC.SuppressFinalize(this);

            if (m_UnmanagedBlob != null && !m_UnmanagedBlob.IsInvalid)
            {
                m_UnmanagedBlob.Close(true);
                m_UnmanagedBlob = null;
            }

            // This is interlocked because Cleanup() can be called simultaneously with ExtractCache().
            OverlappedCache.InterlockedFree(ref m_Cache);

            if (m_OverlappedEvent != null)
            {
                m_OverlappedEvent.Close();
                m_OverlappedEvent = null;
            }
        }