checkpoint
This commit is contained in:
21
Alpm/SafeAlpmHandle.cs
Normal file
21
Alpm/SafeAlpmHandle.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Runtime.ConstrainedExecution;
|
||||
using System.Runtime.InteropServices;
|
||||
using Foodsoft.Alpm;
|
||||
|
||||
namespace Foodsoft.Alpm
|
||||
{
|
||||
internal sealed class SafeAlpmHandle : SafeHandle
|
||||
{
|
||||
private SafeAlpmHandle() : base(IntPtr.Zero, true) { }
|
||||
|
||||
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail), PrePrepareMethod]
|
||||
protected override bool ReleaseHandle() => alpm.alpm_release(handle) == 0;
|
||||
|
||||
public override bool IsInvalid
|
||||
{
|
||||
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success), PrePrepareMethod]
|
||||
get => handle == IntPtr.Zero;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user