Ryujinx/Ryujinx.HLE/HOS/Services/DisposableIpcService.cs
riperiperi fb935fd201
Add dedicated ServerBase for FileSystem services (#3142)
This should prevent filesystem services from blocking other services that don't have their own ServerBase. May improve filesystem related stutters in certain titles.

Improves button advanced cutscenes such as Miqol's Request in Xenoblade: DE when the game is on a network share (used to stutter when voice lines played).

Should probably be tested to make sure no mysterious bugs have been unearthed, and to see if any other filesystem related perf issues are improved.
2022-02-19 15:29:11 +01:00

23 lines
521 B
C#

using System;
using System.Threading;
namespace Ryujinx.HLE.HOS.Services
{
abstract class DisposableIpcService : IpcService, IDisposable
{
private int _disposeState;
public DisposableIpcService(ServerBase server = null) : base(server) { }
protected abstract void Dispose(bool isDisposing);
public void Dispose()
{
if (Interlocked.CompareExchange(ref _disposeState, 1, 0) == 0)
{
Dispose(true);
}
}
}
}