Beispiel #1
0
        protected virtual void Dispose(bool disposing)
        {
            // close all active handles
            foreach (var kvp in handles)
            {
                var handle = kvp.Value;
                if (!handle.IsClosing)
                {
                    handle.Dispose();
                }
            }

            // make sure the callbacks of close are called
            RunOnce();

            if (disposing)
            {
                if (ByteBufferAllocator != null)
                {
                    ByteBufferAllocator.Dispose();
                    ByteBufferAllocator = null;
                }
            }

            int r = uv_loop_close(NativeHandle);

            Ensure.Success(r);
        }
Beispiel #2
0
        protected virtual void Dispose(bool disposing)
        {
            // close all active handles
            foreach (var kvp in handles)
            {
                var handle = kvp.Value;
                if (!handle.IsClosing)
                {
                    handle.Dispose();
                }
            }

            // make sure the callbacks of close are called
            RunOnce();

            if (disposing)
            {
                if (ByteBufferAllocator != null)
                {
                    ByteBufferAllocator.Dispose();
#pragma warning disable CS8625 // Cannot convert null literal to non-nullable reference type.
                    ByteBufferAllocator = null;
#pragma warning restore CS8625 // Cannot convert null literal to non-nullable reference type.
                }
            }

            int r = uv_loop_close(NativeHandle);
            Ensure.Success(r);
        }
Beispiel #3
0
        protected void Dispose(bool disposing)
        {
            if (disposing)
            {
                GC.SuppressFinalize(this);
            }

            if (NativeHandle != Default.NativeHandle)
            {
                uv_loop_delete(NativeHandle);
            }

            if (ByteBufferAllocator != null)
            {
                ByteBufferAllocator.Dispose();
                ByteBufferAllocator = null;
            }
        }