コード例 #1
0
    public static void In()
    {
        IntPtr handleValue = MyCriticalHandle.GetUniqueHandle();

        InWorker(handleValue);
        GC.Collect();
        GC.WaitForPendingFinalizers();
        Assert.IsTrue(MyCriticalHandle.IsHandleClosed(handleValue), "Handle was not closed");
    }
コード例 #2
0
ファイル: Test.cs プロジェクト: z77ma/runtime
    public static void Ref()
    {
        IntPtr handleValue = MyCriticalHandle.GetUniqueHandle();

        RefWorker(handleValue);
        GC.Collect();
        GC.WaitForPendingFinalizers();
        Assert.True(MyCriticalHandle.IsHandleClosed(handleValue));
    }
コード例 #3
0
    public static void RefModify()
    {
        IntPtr handleValue1 = MyCriticalHandle.GetUniqueHandle();
        IntPtr handleValue2 = MyCriticalHandle.GetUniqueHandle();

        RefModifyWorker(handleValue1, handleValue2);
        GC.Collect();
        GC.WaitForPendingFinalizers();
        Assert.IsTrue(MyCriticalHandle.IsHandleClosed(handleValue1), "Handle 1 was not closed");
        Assert.IsTrue(MyCriticalHandle.IsHandleClosed(handleValue2), "Handle 2 was not closed");
    }