Ejemplo n.º 1
0
        /// <summary>
        /// Releases RefCounted instances which were finalized (which can happen on any thread)
        /// </summary>
        static internal void ReleaseFinalized()
        {
            lock (refCountedFinalizerQueue)
            {
                foreach (var native in refCountedFinalizerQueue)
                {
                    NativeCore.RemoveNative(native);
                    NativeCore.csi_AtomicEngine_ReleaseRef(native);
                }

                refCountedFinalizerQueue.Clear();
            }
        }
Ejemplo n.º 2
0
        protected virtual void Dispose(bool disposing)
        {
            disposed = true;

            if (refHandle != null && !refHandle.IsInvalid)
            {
                NativeCore.RemoveNative(nativeInstance);

                // Free the handle
                refHandle.Dispose();
            }

            nativeInstance = IntPtr.Zero;
        }