Debian Codegraph @

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

raw
1 // ==++==
2 //
3 // Copyright (c) Microsoft Corporation. All rights reserved.
4 //
5 // ==--==
6 /*============================================================
7 **
8 ** Class: SafeTimerHandle
9 **
10 ** <EMAIL>Author: David Gutierrez (Microsoft) </EMAIL>
11 **
12 ** A wrapper for a timer handle
13 **
14 ** Date: July 23, 2002
15 **
16 ===========================================================*/
17
18 using System;
19 using System.Security;
20 using System.Security.Permissions;
21 using System.Runtime.InteropServices;
22 using System.Runtime.CompilerServices;
23 using Microsoft.Win32;
24 using Microsoft.Win32.SafeHandles;
25 using System.Runtime.ConstrainedExecution;
26 using System.Runtime.Versioning;
27
28 namespace Microsoft.Win32.SafeHandles {
29 [HostProtectionAttribute(MayLeakOnAbort=true)]
30 [SuppressUnmanagedCodeSecurityAttribute]
31 internal sealed class SafeTimerHandle : SafeHandleZeroOrMinusOneIsInvalid
32 {
33 // Note that CreateWaitableTimer returns 0 on failure
34
35 internal SafeTimerHandle() : base (true) {}
36
37 // Not currently used
38 //[SecurityPermission(SecurityAction.LinkDemand, UnmanagedCode=true)]
39 //internal SafeTimerHandle(IntPtr existingHandle, bool ownsHandle) : base(ownsHandle) {
40 // SetHandle(existingHandle);
41 //}
42
43 [DllImport(ExternDll.Kernel32, ExactSpelling=true, SetLastError=true)]
44 [ResourceExposure(ResourceScope.None)]
45 [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
46 private static extern bool CloseHandle(IntPtr handle);
47
48 override protected bool ReleaseHandle()
49 {
50 return CloseHandle(handle);
51 }
52 }
53 }
54
55
56
57
58
59