SafeHandle.DangerousRelease 方法

定义

手动递减 SafeHandle 实例中的引用计数器。Manually decrements the reference counter on a SafeHandle instance.

public:
 void DangerousRelease();
[System.Security.SecurityCritical]
public void DangerousRelease ();
public void DangerousRelease ();
member this.DangerousRelease : unit -> unit
Public Sub DangerousRelease ()
属性

注解

DangerousRelease 方法是 DangerousAddRef的对应项。The DangerousRelease method is the counterpart to DangerousAddRef. 应始终通过对 DangerousAddRef的调用成功进行匹配 DangerousRelease 方法。You should always match a call to the DangerousRelease method with a successful call to DangerousAddRef.

注意

此方法适用于高级用户,必须始终谨慎使用。This method is intended for advanced users and must always be used carefully. 若要避免泄漏句柄资源,请始终在受约束的执行区域(CER)中调用此方法,在这种情况下,线程中止无法中断处理。To avoid leaking handle resources, always call this method inside a constrained execution region (CER), where a thread abort cannot interrupt processing. 与不匹配的 DangerousAddRef 调用可能会导致资源泄漏一样,不匹配的 DangerousRelease 调用可能会导致无效的句柄状态对其他线程可见。In the same way that unmatched DangerousAddRef calls can cause resource leaks, unmatched DangerousRelease calls can cause invalid handle states to become visible to other threads. 不要向不受信任的代码公开 DangerousAddRefDangerousRelease 调用。Do not expose DangerousAddRef or DangerousRelease calls to untrusted code.

适用于

另请参阅