Debian Codegraph @

mcs/class/referencesource/System/compmod/microsoft/win32/safehandles/SafeThreadHandle.cs

raw
1 // ==++==
2 //
3 // Copyright (c) Microsoft Corporation. All rights reserved.
4 //
5 // ==--==
6 /*============================================================
7 **
8 ** Class: SafeThreadHandle
9 **
10 **
11 ** A wrapper for a thread handle
12 **
13 **
14 ===========================================================*/
15
16 using System;
17 using System.Security;
18 using System.Diagnostics;
19 using System.Security.Permissions;
20 using System.Runtime.InteropServices;
21 using System.Runtime.CompilerServices;
22 using Microsoft.Win32;
23 using Microsoft.Win32.SafeHandles;
24 using System.Runtime.ConstrainedExecution;
25
26 namespace Microsoft.Win32.SafeHandles {
27 [SuppressUnmanagedCodeSecurityAttribute]
28 internal sealed class SafeThreadHandle : SafeHandleZeroOrMinusOneIsInvalid
29 {
30 internal SafeThreadHandle() : base(true) {
31 }
32
33 internal void InitialSetHandle(IntPtr h){
34 Debug.Assert(base.IsInvalid, "Safe handle should only be set once");
35 base.SetHandle(h);
36 }
37
38 override protected bool ReleaseHandle() {
39 return SafeNativeMethods.CloseHandle(handle);
40 }
41
42 }
43 }
44
45
46
47