A cross-platform UI framework for .NET
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

17 lines
414 B

namespace Tmds.DBus.Protocol;
sealed class CloseSafeHandle : SafeHandle
{
public CloseSafeHandle() :
base(new IntPtr(-1), ownsHandle: true)
{ }
public override bool IsInvalid
=> handle == new IntPtr(-1);
protected override bool ReleaseHandle()
=> close(handle.ToInt32()) == 0;
[DllImport("libc", SetLastError = true)]
internal static extern int close(int fd);
}