Windows-powershell / PowerShell-master /src /System.Management.Automation /engine /Interop /Windows /CreateJobObject.cs
| // Copyright (c) Microsoft Corporation. | |
| // Licensed under the MIT License. | |
| using System.Runtime.InteropServices; | |
| internal static partial class Interop | |
| { | |
| internal static partial class Windows | |
| { | |
| internal sealed class SafeJobHandle : SafeHandle | |
| { | |
| public SafeJobHandle() : base(invalidHandleValue: nint.Zero, ownsHandle: true) { } | |
| public override bool IsInvalid => handle == nint.Zero; | |
| protected override bool ReleaseHandle() | |
| => Windows.CloseHandle(handle); | |
| } | |
| [] | |
| private static partial SafeJobHandle CreateJobObject( | |
| nint lpJobAttributes, | |
| nint lpName); | |
| internal static SafeJobHandle CreateJobObject() | |
| => CreateJobObject(nint.Zero, nint.Zero); | |
| } | |
| } | |