ファイル
YMM4-ProxyForge/ProxyForge/Streaming/MfSession.cs
T
routersys 5ef1222518 ZeroDiskProxyからProxyForgeへのプロジェクト全体のリブランディング
プロジェクト名をZeroDiskProxyからProxyForgeへ全面的にリブランディングしました。
2026-03-25 19:58:39 +09:00

28 行
662 B
C#

using ProxyForge.Interop;
namespace ProxyForge.Streaming;
internal static class MfSession
{
private static int _refCount;
private static readonly object Lock = new();
internal static void AddRef()
{
lock (Lock)
{
if (Interlocked.Increment(ref _refCount) == 1)
HResultExtensions.ThrowOnFailure(
MfNativeMethods.MFStartup(MfNativeMethods.MF_VERSION, 0), "MFStartup");
}
}
internal static void Release()
{
lock (Lock)
{
if (Interlocked.Decrement(ref _refCount) == 0)
MfNativeMethods.MFShutdown();
}
}
}