aboutsummaryrefslogtreecommitdiff
path: root/Utils/src/Native/SafeMethodHandle.cs
diff options
context:
space:
mode:
authorLibravatar vnugent <public@vaughnnugent.com>2023-01-08 16:01:54 -0500
committerLibravatar vnugent <public@vaughnnugent.com>2023-01-08 16:01:54 -0500
commitde94d788e9a47432a7630a8215896b8dd3628599 (patch)
tree666dec06eef861d101cb6948aff52a3d354c8d73 /Utils/src/Native/SafeMethodHandle.cs
parentbe6dc557a3b819248b014992eb96c1cb21f8112b (diff)
Reorder + analyzer cleanup
Diffstat (limited to 'Utils/src/Native/SafeMethodHandle.cs')
-rw-r--r--Utils/src/Native/SafeMethodHandle.cs61
1 files changed, 0 insertions, 61 deletions
diff --git a/Utils/src/Native/SafeMethodHandle.cs b/Utils/src/Native/SafeMethodHandle.cs
deleted file mode 100644
index 3ba0879..0000000
--- a/Utils/src/Native/SafeMethodHandle.cs
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
-* Copyright (c) 2022 Vaughn Nugent
-*
-* Library: VNLib
-* Package: VNLib.Utils
-* File: SafeMethodHandle.cs
-*
-* SafeMethodHandle.cs is part of VNLib.Utils which is part of the larger
-* VNLib collection of libraries and utilities.
-*
-* VNLib.Utils is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published
-* by the Free Software Foundation, either version 2 of the License,
-* or (at your option) any later version.
-*
-* VNLib.Utils is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with VNLib.Utils. If not, see http://www.gnu.org/licenses/.
-*/
-
-using System;
-
-using VNLib.Utils.Resources;
-
-namespace VNLib.Utils.Native
-{
- /// <summary>
- /// Represents a handle to a <see cref="SafeLibraryHandle"/>'s
- /// native method
- /// </summary>
- /// <typeparam name="T">The native method deelgate type</typeparam>
- public class SafeMethodHandle<T> : OpenHandle where T : Delegate
- {
- private T? _method;
- private readonly SafeLibraryHandle Library;
-
- internal SafeMethodHandle(SafeLibraryHandle lib, T method)
- {
- Library = lib;
- _method = method;
- }
-
- /// <summary>
- /// A delegate to the native method
- /// </summary>
- public T? Method => _method;
-
- ///<inheritdoc/>
- protected override void Free()
- {
- //Release the method
- _method = default;
- //Decrement lib handle count
- Library.DangerousRelease();
- }
- }
-}