InternalFree() private method

private InternalFree ( IntPtr handle ) : void
handle System.IntPtr
return void
Exemplo n.º 1
0
        public void Free()
        {
            IntPtr num = this.m_handle;

            if (!(num != IntPtr.Zero) || !(Interlocked.CompareExchange(ref this.m_handle, IntPtr.Zero, num) == num))
            {
                throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_HandleIsNotInitialized"));
            }
            if (GCHandle.s_probeIsActive)
            {
                GCHandle.s_cookieTable.RemoveHandleIfPresent(num);
            }
            GCHandle.InternalFree((IntPtr)((int)num & -2));
        }
Exemplo n.º 2
0
        public void Free()
        {
            IntPtr handle = this.m_handle;

            if (handle != IntPtr.Zero && Interlocked.CompareExchange(ref this.m_handle, IntPtr.Zero, handle) == handle)
            {
                if (GCHandle.s_probeIsActive)
                {
                    GCHandle.s_cookieTable.RemoveHandleIfPresent(handle);
                }
                GCHandle.InternalFree((IntPtr)((long)handle & -2L));
                return;
            }
            throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_HandleIsNotInitialized"));
        }