ryujinx/src/Ryujinx.Cpu/MemoryManagerBase.cs
TSRBerry 2989c163a8
editorconfig: Set default encoding to UTF-8 (#5793)
* editorconfig: Add default charset

* Change file encoding from UTF-8-BOM to UTF-8
2023-12-04 14:17:13 +01:00

33 lines
712 B
C#

using Ryujinx.Memory;
using System.Diagnostics;
using System.Threading;
namespace Ryujinx.Cpu
{
public abstract class MemoryManagerBase : IRefCounted
{
private int _referenceCount;
public void IncrementReferenceCount()
{
int newRefCount = Interlocked.Increment(ref _referenceCount);
Debug.Assert(newRefCount >= 1);
}
public void DecrementReferenceCount()
{
int newRefCount = Interlocked.Decrement(ref _referenceCount);
Debug.Assert(newRefCount >= 0);
if (newRefCount == 0)
{
Destroy();
}
}
protected abstract void Destroy();
}
}