Use the new Lock type where applicable
This commit is contained in:
parent
4928551393
commit
e42ae95895
54 changed files with 109 additions and 76 deletions
|
@ -1,6 +1,7 @@
|
|||
<Project>
|
||||
<PropertyGroup>
|
||||
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
|
||||
<LangVersion>preview</LangVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageVersion Include="Avalonia" Version="11.0.10" />
|
||||
|
|
|
@ -8,6 +8,7 @@ using System.Collections.Generic;
|
|||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.Versioning;
|
||||
using System.Threading;
|
||||
|
||||
namespace ARMeilleure.Translation.Cache
|
||||
{
|
||||
|
@ -26,7 +27,7 @@ namespace ARMeilleure.Translation.Cache
|
|||
|
||||
private static readonly List<CacheEntry> _cacheEntries = new();
|
||||
|
||||
private static readonly object _lock = new();
|
||||
private static readonly Lock _lock = new();
|
||||
private static bool _initialized;
|
||||
|
||||
[SupportedOSPlatform("windows")]
|
||||
|
|
|
@ -57,7 +57,7 @@ namespace ARMeilleure.Translation.PTC
|
|||
|
||||
private readonly ManualResetEvent _waitEvent;
|
||||
|
||||
private readonly object _lock;
|
||||
private readonly Lock _lock;
|
||||
|
||||
private bool _disposed;
|
||||
|
||||
|
@ -87,7 +87,7 @@ namespace ARMeilleure.Translation.PTC
|
|||
|
||||
_waitEvent = new ManualResetEvent(true);
|
||||
|
||||
_lock = new object();
|
||||
_lock = new Lock();
|
||||
|
||||
_disposed = false;
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ namespace ARMeilleure.Translation.PTC
|
|||
|
||||
private readonly ManualResetEvent _waitEvent;
|
||||
|
||||
private readonly object _lock;
|
||||
private readonly Lock _lock;
|
||||
|
||||
private bool _disposed;
|
||||
|
||||
|
@ -65,7 +65,7 @@ namespace ARMeilleure.Translation.PTC
|
|||
|
||||
_waitEvent = new ManualResetEvent(true);
|
||||
|
||||
_lock = new object();
|
||||
_lock = new Lock();
|
||||
|
||||
_disposed = false;
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ using Ryujinx.Memory;
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Threading;
|
||||
|
||||
namespace Ryujinx.Audio.Backends.OpenAL
|
||||
{
|
||||
|
@ -18,7 +19,7 @@ namespace Ryujinx.Audio.Backends.OpenAL
|
|||
private ulong _playedSampleCount;
|
||||
private float _volume;
|
||||
|
||||
private readonly object _lock = new();
|
||||
private readonly Lock _lock = new();
|
||||
|
||||
public OpenALHardwareDeviceSession(OpenALHardwareDeviceDriver driver, IVirtualMemoryManager memoryManager, SampleFormat requestedSampleFormat, uint requestedSampleRate, uint requestedChannelCount) : base(memoryManager, requestedSampleFormat, requestedSampleRate, requestedChannelCount)
|
||||
{
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace Ryujinx.Audio
|
|||
/// <summary>
|
||||
/// Lock used to control the waiters registration.
|
||||
/// </summary>
|
||||
private readonly object _lock = new();
|
||||
private readonly Lock _lock = new();
|
||||
|
||||
/// <summary>
|
||||
/// Events signaled when the driver played audio buffers.
|
||||
|
|
|
@ -2,6 +2,7 @@ using Ryujinx.Common;
|
|||
using Ryujinx.Common.Memory;
|
||||
using System;
|
||||
using System.Buffers;
|
||||
using System.Threading;
|
||||
|
||||
namespace Ryujinx.Audio.Backends.Common
|
||||
{
|
||||
|
@ -12,7 +13,7 @@ namespace Ryujinx.Audio.Backends.Common
|
|||
{
|
||||
private const int RingBufferAlignment = 2048;
|
||||
|
||||
private readonly object _lock = new();
|
||||
private readonly Lock _lock = new();
|
||||
|
||||
private MemoryOwner<byte> _bufferOwner;
|
||||
private Memory<byte> _buffer;
|
||||
|
|
|
@ -14,12 +14,12 @@ namespace Ryujinx.Audio.Input
|
|||
/// </summary>
|
||||
public class AudioInputManager : IDisposable
|
||||
{
|
||||
private readonly object _lock = new();
|
||||
private readonly Lock _lock = new();
|
||||
|
||||
/// <summary>
|
||||
/// Lock used for session allocation.
|
||||
/// </summary>
|
||||
private readonly object _sessionLock = new();
|
||||
private readonly Lock _sessionLock = new();
|
||||
|
||||
/// <summary>
|
||||
/// The session ids allocation table.
|
||||
|
|
|
@ -48,7 +48,7 @@ namespace Ryujinx.Audio.Input
|
|||
/// <summary>
|
||||
/// The lock of the parent.
|
||||
/// </summary>
|
||||
private readonly object _parentLock;
|
||||
private readonly Lock _parentLock;
|
||||
|
||||
/// <summary>
|
||||
/// The dispose state.
|
||||
|
@ -62,7 +62,7 @@ namespace Ryujinx.Audio.Input
|
|||
/// <param name="parentLock">The lock of the manager</param>
|
||||
/// <param name="deviceSession">The hardware device session</param>
|
||||
/// <param name="bufferEvent">The buffer release event of the audio input</param>
|
||||
public AudioInputSystem(AudioInputManager manager, object parentLock, IHardwareDeviceSession deviceSession, IWritableEvent bufferEvent)
|
||||
public AudioInputSystem(AudioInputManager manager, Lock parentLock, IHardwareDeviceSession deviceSession, IWritableEvent bufferEvent)
|
||||
{
|
||||
_manager = manager;
|
||||
_parentLock = parentLock;
|
||||
|
|
|
@ -14,12 +14,12 @@ namespace Ryujinx.Audio.Output
|
|||
/// </summary>
|
||||
public class AudioOutputManager : IDisposable
|
||||
{
|
||||
private readonly object _lock = new();
|
||||
private readonly Lock _lock = new();
|
||||
|
||||
/// <summary>
|
||||
/// Lock used for session allocation.
|
||||
/// </summary>
|
||||
private readonly object _sessionLock = new();
|
||||
private readonly Lock _sessionLock = new();
|
||||
|
||||
/// <summary>
|
||||
/// The session ids allocation table.
|
||||
|
|
|
@ -48,7 +48,7 @@ namespace Ryujinx.Audio.Output
|
|||
/// <summary>
|
||||
/// THe lock of the parent.
|
||||
/// </summary>
|
||||
private readonly object _parentLock;
|
||||
private readonly Lock _parentLock;
|
||||
|
||||
/// <summary>
|
||||
/// The dispose state.
|
||||
|
@ -62,7 +62,7 @@ namespace Ryujinx.Audio.Output
|
|||
/// <param name="parentLock">The lock of the manager</param>
|
||||
/// <param name="deviceSession">The hardware device session</param>
|
||||
/// <param name="bufferEvent">The buffer release event of the audio output</param>
|
||||
public AudioOutputSystem(AudioOutputManager manager, object parentLock, IHardwareDeviceSession deviceSession, IWritableEvent bufferEvent)
|
||||
public AudioOutputSystem(AudioOutputManager manager, Lock parentLock, IHardwareDeviceSession deviceSession, IWritableEvent bufferEvent)
|
||||
{
|
||||
_manager = manager;
|
||||
_parentLock = parentLock;
|
||||
|
|
|
@ -26,7 +26,7 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||
{
|
||||
public class AudioRenderSystem : IDisposable
|
||||
{
|
||||
private readonly object _lock = new();
|
||||
private readonly Lock _lock = new();
|
||||
|
||||
private AudioRendererRenderingDevice _renderingDevice;
|
||||
private AudioRendererExecutionMode _executionMode;
|
||||
|
|
|
@ -19,12 +19,12 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||
/// <summary>
|
||||
/// Lock used for session allocation.
|
||||
/// </summary>
|
||||
private readonly object _sessionLock = new();
|
||||
private readonly Lock _sessionLock = new();
|
||||
|
||||
/// <summary>
|
||||
/// Lock used to control the <see cref="AudioProcessor"/> running state.
|
||||
/// </summary>
|
||||
private readonly object _audioProcessorLock = new();
|
||||
private readonly Lock _audioProcessorLock = new();
|
||||
|
||||
/// <summary>
|
||||
/// The session ids allocation table.
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Threading;
|
||||
|
||||
namespace Ryujinx.Audio.Renderer.Server.Upsampler
|
||||
{
|
||||
|
@ -16,7 +17,7 @@ namespace Ryujinx.Audio.Renderer.Server.Upsampler
|
|||
/// <summary>
|
||||
/// Global lock of the object.
|
||||
/// </summary>
|
||||
private readonly object _lock = new();
|
||||
private readonly Lock _lock = new();
|
||||
|
||||
/// <summary>
|
||||
/// The upsamplers instances.
|
||||
|
|
|
@ -124,7 +124,7 @@ namespace Ryujinx.Common.PreciseSleep
|
|||
}
|
||||
}
|
||||
|
||||
private readonly object _lock = new();
|
||||
private readonly Lock _lock = new();
|
||||
private readonly List<NanosleepThread> _threads = new();
|
||||
private readonly List<NanosleepThread> _active = new();
|
||||
private readonly Stack<NanosleepThread> _free = new();
|
||||
|
|
|
@ -50,7 +50,7 @@ namespace Ryujinx.Common.SystemInterop
|
|||
private long _lastTicks = PerformanceCounter.ElapsedTicks;
|
||||
private long _lastId;
|
||||
|
||||
private readonly object _lock = new();
|
||||
private readonly Lock _lock = new();
|
||||
private readonly List<WaitingObject> _waitingObjects = new();
|
||||
|
||||
private WindowsGranularTimer()
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using Ryujinx.Memory;
|
||||
using System;
|
||||
using System.Runtime.Versioning;
|
||||
using System.Threading;
|
||||
|
||||
namespace Ryujinx.Cpu.AppleHv
|
||||
{
|
||||
|
@ -12,7 +13,7 @@ namespace Ryujinx.Cpu.AppleHv
|
|||
|
||||
private static int _addressSpaces;
|
||||
private static HvIpaAllocator _ipaAllocator;
|
||||
private static readonly object _lock = new();
|
||||
private static readonly Lock _lock = new();
|
||||
|
||||
public static (ulong, HvIpaAllocator) CreateAddressSpace(MemoryBlock block)
|
||||
{
|
||||
|
|
|
@ -5,6 +5,7 @@ using System.Collections.Generic;
|
|||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.Versioning;
|
||||
using System.Threading;
|
||||
|
||||
namespace Ryujinx.Cpu.LightningJit.Cache
|
||||
{
|
||||
|
@ -23,7 +24,7 @@ namespace Ryujinx.Cpu.LightningJit.Cache
|
|||
|
||||
private static readonly List<CacheEntry> _cacheEntries = new();
|
||||
|
||||
private static readonly object _lock = new();
|
||||
private static readonly Lock _lock = new();
|
||||
private static bool _initialized;
|
||||
|
||||
[SupportedOSPlatform("windows")]
|
||||
|
|
|
@ -4,6 +4,7 @@ using Ryujinx.Memory;
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Threading;
|
||||
|
||||
namespace Ryujinx.Cpu.LightningJit.Cache
|
||||
{
|
||||
|
@ -104,7 +105,7 @@ namespace Ryujinx.Cpu.LightningJit.Cache
|
|||
private readonly MemoryCache _sharedCache;
|
||||
private readonly MemoryCache _localCache;
|
||||
private readonly PageAlignedRangeList _pendingMap;
|
||||
private readonly object _lock;
|
||||
private readonly Lock _lock;
|
||||
|
||||
class ThreadLocalCacheEntry
|
||||
{
|
||||
|
|
|
@ -5,6 +5,7 @@ using System;
|
|||
using System.Diagnostics;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
|
||||
namespace Ryujinx.Cpu.Signal
|
||||
{
|
||||
|
@ -59,7 +60,7 @@ namespace Ryujinx.Cpu.Signal
|
|||
|
||||
private static MemoryBlock _codeBlock;
|
||||
|
||||
private static readonly object _lock = new();
|
||||
private static readonly Lock _lock = new();
|
||||
private static bool _initialized;
|
||||
|
||||
static NativeSignalHandler()
|
||||
|
|
|
@ -56,7 +56,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading
|
|||
private int _refConsumerPtr;
|
||||
|
||||
private Action _interruptAction;
|
||||
private readonly object _interruptLock = new();
|
||||
private readonly Lock _interruptLock = new();
|
||||
|
||||
public event EventHandler<ScreenCaptureImageInfo> ScreenCaptured;
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ using Ryujinx.Common.Pools;
|
|||
using Ryujinx.Memory.Range;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
|
||||
namespace Ryujinx.Graphics.Gpu.Memory
|
||||
{
|
||||
|
@ -76,7 +77,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
|
|||
private BufferMigration _source;
|
||||
private BufferModifiedRangeList _migrationTarget;
|
||||
|
||||
private readonly object _lock = new();
|
||||
private readonly Lock _lock = new();
|
||||
|
||||
/// <summary>
|
||||
/// Whether the modified range list has any entries or not.
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace Ryujinx.Graphics.OpenGL.Queries
|
|||
private ulong _accumulatedCounter;
|
||||
private int _waiterCount;
|
||||
|
||||
private readonly object _lock = new();
|
||||
private readonly Lock _lock = new();
|
||||
|
||||
private readonly Queue<BufferedQuery> _queryPool;
|
||||
private readonly AutoResetEvent _queuedEvent = new(false);
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace Ryujinx.Graphics.OpenGL.Queries
|
|||
private bool _hostAccessReserved = false;
|
||||
private int _refCount = 1; // Starts with a reference from the counter queue.
|
||||
|
||||
private readonly object _lock = new();
|
||||
private readonly Lock _lock = new();
|
||||
private ulong _result = ulong.MaxValue;
|
||||
private double _divisor = 1f;
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ using Ryujinx.Graphics.GAL;
|
|||
using Ryujinx.Graphics.OpenGL.Image;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
|
||||
namespace Ryujinx.Graphics.OpenGL
|
||||
{
|
||||
|
@ -19,7 +20,7 @@ namespace Ryujinx.Graphics.OpenGL
|
|||
{
|
||||
private const int DisposedLiveFrames = 2;
|
||||
|
||||
private readonly object _lock = new();
|
||||
private readonly Lock _lock = new();
|
||||
private readonly Dictionary<TextureCreateInfo, List<DisposedTexture>> _textures = new();
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -4,6 +4,7 @@ using Ryujinx.Graphics.Shader.StructuredIr;
|
|||
using Ryujinx.Graphics.Shader.Translation;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using static Spv.Specification;
|
||||
|
||||
namespace Ryujinx.Graphics.Shader.CodeGen.Spirv
|
||||
|
@ -19,13 +20,13 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv
|
|||
private const int GeneratorPoolCount = 1;
|
||||
private static readonly ObjectPool<SpvInstructionPool> _instructionPool;
|
||||
private static readonly ObjectPool<SpvLiteralIntegerPool> _integerPool;
|
||||
private static readonly object _poolLock;
|
||||
private static readonly Lock _poolLock;
|
||||
|
||||
static SpirvGenerator()
|
||||
{
|
||||
_instructionPool = new(() => new SpvInstructionPool(), GeneratorPoolCount);
|
||||
_integerPool = new(() => new SpvLiteralIntegerPool(), GeneratorPoolCount);
|
||||
_poolLock = new object();
|
||||
_poolLock = new Lock();
|
||||
}
|
||||
|
||||
private const HelperFunctionsMask NeedsInvocationIdMask = HelperFunctionsMask.SwizzleAdd;
|
||||
|
|
|
@ -25,7 +25,7 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
{
|
||||
bool useBackground = _gd.BackgroundQueue.Handle != 0 && _gd.Vendor != Vendor.Amd;
|
||||
Queue queue = useBackground ? _gd.BackgroundQueue : _gd.Queue;
|
||||
object queueLock = useBackground ? _gd.BackgroundQueueLock : _gd.QueueLock;
|
||||
Lock queueLock = useBackground ? _gd.BackgroundQueueLock : _gd.QueueLock;
|
||||
|
||||
lock (queueLock)
|
||||
{
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
private readonly Vk _api;
|
||||
private readonly Device _device;
|
||||
private readonly Queue _queue;
|
||||
private readonly object _queueLock;
|
||||
private readonly Lock _queueLock;
|
||||
private readonly bool _concurrentFenceWaitUnsupported;
|
||||
private readonly CommandPool _pool;
|
||||
private readonly Thread _owner;
|
||||
|
@ -63,7 +63,7 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
Vk api,
|
||||
Device device,
|
||||
Queue queue,
|
||||
object queueLock,
|
||||
Lock queueLock,
|
||||
uint queueFamilyIndex,
|
||||
bool concurrentFenceWaitUnsupported,
|
||||
bool isLight = false)
|
||||
|
|
|
@ -5,6 +5,7 @@ using Silk.NET.Vulkan;
|
|||
using Silk.NET.Vulkan.Extensions.EXT;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
|
||||
namespace Ryujinx.Graphics.Vulkan
|
||||
{
|
||||
|
@ -31,7 +32,7 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
private readonly Vk _api;
|
||||
private readonly ExtExternalMemoryHost _hostMemoryApi;
|
||||
private readonly Device _device;
|
||||
private readonly object _lock = new();
|
||||
private readonly Lock _lock = new();
|
||||
|
||||
private readonly List<HostMemoryAllocation> _allocations;
|
||||
private readonly IntervalTree<ulong, HostMemoryAllocation> _allocationTree;
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace Ryujinx.Graphics.Vulkan.Queries
|
|||
private ulong _accumulatedCounter;
|
||||
private int _waiterCount;
|
||||
|
||||
private readonly object _lock = new();
|
||||
private readonly Lock _lock = new();
|
||||
|
||||
private readonly Queue<BufferedQuery> _queryPool;
|
||||
private readonly AutoResetEvent _queuedEvent = new(false);
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace Ryujinx.Graphics.Vulkan.Queries
|
|||
private bool _hostAccessReserved;
|
||||
private int _refCount = 1; // Starts with a reference from the counter queue.
|
||||
|
||||
private readonly object _lock = new();
|
||||
private readonly Lock _lock = new();
|
||||
private ulong _result = ulong.MaxValue;
|
||||
private double _divisor = 1f;
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ using shaderc;
|
|||
using Silk.NET.Vulkan;
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Ryujinx.Graphics.Vulkan
|
||||
|
@ -13,7 +14,7 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
{
|
||||
// The shaderc.net dependency's Options constructor and dispose are not thread safe.
|
||||
// Take this lock when using them.
|
||||
private static readonly object _shaderOptionsLock = new();
|
||||
private static readonly Lock _shaderOptionsLock = new();
|
||||
|
||||
private static readonly IntPtr _ptrMainEntryPointName = Marshal.StringToHGlobalAnsi("main");
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ using Silk.NET.Vulkan.Extensions.KHR;
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
using Format = Ryujinx.Graphics.GAL.Format;
|
||||
using PrimitiveTopology = Ryujinx.Graphics.GAL.PrimitiveTopology;
|
||||
using SamplerCreateInfo = Ryujinx.Graphics.GAL.SamplerCreateInfo;
|
||||
|
@ -42,8 +43,8 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
internal uint QueueFamilyIndex { get; private set; }
|
||||
internal Queue Queue { get; private set; }
|
||||
internal Queue BackgroundQueue { get; private set; }
|
||||
internal object BackgroundQueueLock { get; private set; }
|
||||
internal object QueueLock { get; private set; }
|
||||
internal Lock BackgroundQueueLock { get; private set; }
|
||||
internal Lock QueueLock { get; private set; }
|
||||
|
||||
internal MemoryAllocator MemoryAllocator { get; private set; }
|
||||
internal HostMemoryAllocator HostMemoryAllocator { get; private set; }
|
||||
|
@ -153,7 +154,7 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
{
|
||||
Api.GetDeviceQueue(_device, queueFamilyIndex, 1, out var backgroundQueue);
|
||||
BackgroundQueue = backgroundQueue;
|
||||
BackgroundQueueLock = new object();
|
||||
BackgroundQueueLock = new Lock();
|
||||
}
|
||||
|
||||
PhysicalDeviceProperties2 properties2 = new()
|
||||
|
@ -458,7 +459,7 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
|
||||
Api.GetDeviceQueue(_device, queueFamilyIndex, 0, out var queue);
|
||||
Queue = queue;
|
||||
QueueLock = new object();
|
||||
QueueLock = new Lock();
|
||||
|
||||
LoadFeatures(maxQueueCount, queueFamilyIndex);
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ using Ryujinx.Common.Configuration.Hid.Keyboard;
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
using System.Threading;
|
||||
using ConfigKey = Ryujinx.Common.Configuration.Hid.Key;
|
||||
|
||||
namespace Ryujinx.Input.GTK3
|
||||
|
@ -21,7 +22,7 @@ namespace Ryujinx.Input.GTK3
|
|||
}
|
||||
}
|
||||
|
||||
private readonly object _userMappingLock = new();
|
||||
private readonly Lock _userMappingLock = new();
|
||||
|
||||
private readonly GTK3KeyboardDriver _driver;
|
||||
private StandardKeyboardInputConfig _configuration;
|
||||
|
|
|
@ -21,6 +21,7 @@ using System.IO;
|
|||
using System.IO.Compression;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using Path = System.IO.Path;
|
||||
|
||||
namespace Ryujinx.HLE.FileSystem
|
||||
|
@ -54,7 +55,7 @@ namespace Ryujinx.HLE.FileSystem
|
|||
|
||||
private readonly VirtualFileSystem _virtualFileSystem;
|
||||
|
||||
private readonly object _lock = new();
|
||||
private readonly Lock _lock = new();
|
||||
|
||||
public ContentManager(VirtualFileSystem virtualFileSystem)
|
||||
{
|
||||
|
|
|
@ -14,6 +14,7 @@ using System.IO;
|
|||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
|
||||
namespace Ryujinx.HLE.HOS.Applets
|
||||
{
|
||||
|
@ -62,7 +63,7 @@ namespace Ryujinx.HLE.HOS.Applets
|
|||
private bool _canAcceptController = false;
|
||||
private KeyboardInputMode _inputMode = KeyboardInputMode.ControllerAndKeyboard;
|
||||
|
||||
private readonly object _lock = new();
|
||||
private readonly Lock _lock = new();
|
||||
|
||||
public event EventHandler AppletStateChanged;
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ using System.IO;
|
|||
using System.Numerics;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
|
||||
namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
|
||||
{
|
||||
|
@ -26,7 +27,7 @@ namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
|
|||
const string CancelText = "Cancel";
|
||||
const string ControllerToggleText = "Toggle input";
|
||||
|
||||
private readonly object _bufferLock = new();
|
||||
private readonly Lock _bufferLock = new();
|
||||
|
||||
private RenderingSurfaceInfo _surfaceInfo = null;
|
||||
private Image<Argb32> _surface = null;
|
||||
|
|
|
@ -27,7 +27,7 @@ namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
|
|||
|
||||
private TRef<bool> _cancelled = null;
|
||||
private Thread _thread = null;
|
||||
private readonly object _lock = new();
|
||||
private readonly Lock _lock = new();
|
||||
|
||||
public bool IsRunning
|
||||
{
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using Ryujinx.Common.Memory;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
|
||||
namespace Ryujinx.HLE.HOS.Services.Ldn.Types
|
||||
{
|
||||
|
@ -12,7 +13,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.Types
|
|||
|
||||
static class NodeLatestUpdateHelper
|
||||
{
|
||||
private static readonly object _lock = new();
|
||||
private static readonly Lock _lock = new();
|
||||
|
||||
public static void CalculateLatestUpdate(this Array8<NodeLatestUpdate> array, Array8<NodeInfo> beforeNodes, Array8<NodeInfo> afterNodes)
|
||||
{
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
using Ryujinx.Common;
|
||||
using System.Threading;
|
||||
using System.Timers;
|
||||
using Timer = System.Timers.Timer;
|
||||
|
||||
namespace Ryujinx.HLE
|
||||
{
|
||||
|
@ -20,8 +22,8 @@ namespace Ryujinx.HLE
|
|||
private readonly long[] _framesRendered;
|
||||
private readonly double[] _percentTime;
|
||||
|
||||
private readonly object[] _frameLock;
|
||||
private readonly object[] _percentLock;
|
||||
private readonly Lock[] _frameLock;
|
||||
private readonly Lock[] _percentLock;
|
||||
|
||||
private readonly double _ticksToSeconds;
|
||||
|
||||
|
@ -41,8 +43,8 @@ namespace Ryujinx.HLE
|
|||
_framesRendered = new long[1];
|
||||
_percentTime = new double[1];
|
||||
|
||||
_frameLock = new[] { new object() };
|
||||
_percentLock = new[] { new object() };
|
||||
_frameLock = new[] { new Lock() };
|
||||
_percentLock = new[] { new Lock() };
|
||||
|
||||
_resetTimer = new Timer(750);
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ using Ryujinx.Horizon.Sdk.OsTypes;
|
|||
using Ryujinx.Horizon.Sdk.Sf;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
|
||||
namespace Ryujinx.Horizon.Sdk.Friends.Detail.Ipc
|
||||
{
|
||||
|
@ -13,7 +14,7 @@ namespace Ryujinx.Horizon.Sdk.Friends.Detail.Ipc
|
|||
private readonly Uid _userId;
|
||||
private readonly FriendsServicePermissionLevel _permissionLevel;
|
||||
|
||||
private readonly object _lock = new();
|
||||
private readonly Lock _lock = new();
|
||||
|
||||
private SystemEventType _notificationEvent;
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ using Ryujinx.Common;
|
|||
using Ryujinx.Horizon.Common;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
|
||||
namespace Ryujinx.Horizon.Sdk.OsTypes.Impl
|
||||
{
|
||||
|
@ -13,7 +14,7 @@ namespace Ryujinx.Horizon.Sdk.OsTypes.Impl
|
|||
|
||||
private readonly List<MultiWaitHolderBase> _multiWaits;
|
||||
|
||||
private readonly object _lock = new();
|
||||
private readonly Lock _lock = new();
|
||||
|
||||
private int _waitingThreadHandle;
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using Ryujinx.Horizon.Common;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
|
||||
namespace Ryujinx.Horizon.Sdk.Sf.Cmif
|
||||
{
|
||||
|
@ -209,14 +210,14 @@ namespace Ryujinx.Horizon.Sdk.Sf.Cmif
|
|||
}
|
||||
|
||||
private readonly EntryManager _entryManager;
|
||||
private readonly object _entryOwnerLock;
|
||||
private readonly Lock _entryOwnerLock;
|
||||
private readonly HashSet<Domain> _domains;
|
||||
private readonly int _maxDomains;
|
||||
|
||||
public ServerDomainManager(int entryCount, int maxDomains)
|
||||
{
|
||||
_entryManager = new EntryManager(entryCount);
|
||||
_entryOwnerLock = new object();
|
||||
_entryOwnerLock = new Lock();
|
||||
_domains = new HashSet<Domain>();
|
||||
_maxDomains = maxDomains;
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ using Ryujinx.Horizon.Sdk.Sm;
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
using System.Threading;
|
||||
|
||||
namespace Ryujinx.Horizon.Sdk.Sf.Hipc
|
||||
{
|
||||
|
@ -17,7 +18,7 @@ namespace Ryujinx.Horizon.Sdk.Sf.Hipc
|
|||
private readonly ulong _pointerBuffersBaseAddress;
|
||||
private readonly ulong _savedMessagesBaseAddress;
|
||||
|
||||
private readonly object _resourceLock;
|
||||
private readonly Lock _resourceLock;
|
||||
private readonly ulong[] _sessionAllocationBitmap;
|
||||
private readonly HashSet<ServerSession> _sessions;
|
||||
private readonly HashSet<Server> _servers;
|
||||
|
@ -42,7 +43,7 @@ namespace Ryujinx.Horizon.Sdk.Sf.Hipc
|
|||
}
|
||||
}
|
||||
|
||||
_resourceLock = new object();
|
||||
_resourceLock = new Lock();
|
||||
_sessionAllocationBitmap = new ulong[(maxSessions + 63) / 64];
|
||||
_sessions = new HashSet<ServerSession>();
|
||||
_servers = new HashSet<Server>();
|
||||
|
|
|
@ -4,6 +4,7 @@ using Ryujinx.Horizon.Sdk.Sf.Cmif;
|
|||
using Ryujinx.Horizon.Sdk.Sm;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
|
||||
namespace Ryujinx.Horizon.Sdk.Sf.Hipc
|
||||
{
|
||||
|
@ -16,8 +17,8 @@ namespace Ryujinx.Horizon.Sdk.Sf.Hipc
|
|||
private readonly MultiWait _multiWait;
|
||||
private readonly MultiWait _waitList;
|
||||
|
||||
private readonly object _multiWaitSelectionLock;
|
||||
private readonly object _waitListLock;
|
||||
private readonly Lock _multiWaitSelectionLock;
|
||||
private readonly Lock _waitListLock;
|
||||
|
||||
private readonly Event _requestStopEvent;
|
||||
private readonly Event _notifyEvent;
|
||||
|
@ -39,8 +40,8 @@ namespace Ryujinx.Horizon.Sdk.Sf.Hipc
|
|||
_multiWait = new MultiWait();
|
||||
_waitList = new MultiWait();
|
||||
|
||||
_multiWaitSelectionLock = new object();
|
||||
_waitListLock = new object();
|
||||
_multiWaitSelectionLock = new Lock();
|
||||
_waitListLock = new Lock();
|
||||
|
||||
_requestStopEvent = new Event(EventClearMode.ManualClear);
|
||||
_notifyEvent = new Event(EventClearMode.ManualClear);
|
||||
|
|
|
@ -4,6 +4,7 @@ using Ryujinx.Common.Logging;
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
using System.Threading;
|
||||
using static SDL2.SDL;
|
||||
|
||||
namespace Ryujinx.Input.SDL2
|
||||
|
@ -55,7 +56,7 @@ namespace Ryujinx.Input.SDL2
|
|||
SDL_GameControllerButton.SDL_CONTROLLER_BUTTON_INVALID,
|
||||
};
|
||||
|
||||
private readonly object _userMappingLock = new();
|
||||
private readonly Lock _userMappingLock = new();
|
||||
|
||||
private readonly List<ButtonMappingEntry> _buttonsUserMapping;
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using Ryujinx.SDL2.Common;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using static SDL2.SDL;
|
||||
|
||||
namespace Ryujinx.Input.SDL2
|
||||
|
@ -9,7 +10,7 @@ namespace Ryujinx.Input.SDL2
|
|||
{
|
||||
private readonly Dictionary<int, string> _gamepadsInstanceIdsMapping;
|
||||
private readonly List<string> _gamepadsIds;
|
||||
private readonly object _lock = new object();
|
||||
private readonly Lock _lock = new();
|
||||
|
||||
public ReadOnlySpan<string> GamepadsIds
|
||||
{
|
||||
|
|
|
@ -4,6 +4,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Threading;
|
||||
using static SDL2.SDL;
|
||||
|
||||
using ConfigKey = Ryujinx.Common.Configuration.Hid.Key;
|
||||
|
@ -24,7 +25,7 @@ namespace Ryujinx.Input.SDL2
|
|||
}
|
||||
}
|
||||
|
||||
private readonly object _userMappingLock = new();
|
||||
private readonly Lock _userMappingLock = new();
|
||||
|
||||
#pragma warning disable IDE0052 // Remove unread private member
|
||||
private readonly SDL2KeyboardDriver _driver;
|
||||
|
|
|
@ -7,6 +7,7 @@ using System.Collections.Generic;
|
|||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Threading;
|
||||
using CemuHookClient = Ryujinx.Input.Motion.CemuHook.Client;
|
||||
using ControllerType = Ryujinx.Common.Configuration.Hid.ControllerType;
|
||||
using PlayerIndex = Ryujinx.HLE.HOS.Services.Hid.PlayerIndex;
|
||||
|
@ -18,7 +19,7 @@ namespace Ryujinx.Input.HLE
|
|||
{
|
||||
private readonly CemuHookClient _cemuHookClient;
|
||||
|
||||
private readonly object _lock = new();
|
||||
private readonly Lock _lock = new();
|
||||
|
||||
private bool _blockInputUpdates;
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using Ryujinx.Common.Pools;
|
||||
using Ryujinx.Memory.Range;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
|
||||
namespace Ryujinx.Memory.Tracking
|
||||
{
|
||||
|
@ -26,7 +27,7 @@ namespace Ryujinx.Memory.Tracking
|
|||
/// This lock must be obtained when traversing or updating the region-handle hierarchy.
|
||||
/// It is not required when reading dirty flags.
|
||||
/// </summary>
|
||||
internal object TrackingLock = new();
|
||||
internal Lock TrackingLock = new();
|
||||
|
||||
/// <summary>
|
||||
/// Create a new tracking structure for the given "physical" memory block,
|
||||
|
|
|
@ -51,7 +51,7 @@ namespace Ryujinx.Memory.Tracking
|
|||
|
||||
private event Action OnDirty;
|
||||
|
||||
private readonly object _preActionLock = new();
|
||||
private readonly Lock _preActionLock = new();
|
||||
private RegionSignal _preAction; // Action to perform before a read or write. This will block the memory access.
|
||||
private PreciseRegionSignal _preciseAction; // Action to perform on a precise read or write.
|
||||
private readonly List<VirtualRegion> _regions;
|
||||
|
@ -278,7 +278,7 @@ namespace Ryujinx.Memory.Tracking
|
|||
}
|
||||
|
||||
// Temporarily release the tracking lock while we're running the action.
|
||||
Monitor.Exit(_tracking.TrackingLock);
|
||||
_tracking.TrackingLock.Exit();
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -293,7 +293,7 @@ namespace Ryujinx.Memory.Tracking
|
|||
}
|
||||
finally
|
||||
{
|
||||
Monitor.Enter(_tracking.TrackingLock);
|
||||
_tracking.TrackingLock.Enter();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ namespace Ryujinx.SDL2.Common
|
|||
|
||||
private ConcurrentDictionary<uint, Action<SDL_Event>> _registeredWindowHandlers;
|
||||
|
||||
private readonly object _lock = new();
|
||||
private readonly Lock _lock = new();
|
||||
|
||||
private SDL2Driver() { }
|
||||
|
||||
|
|
|
@ -117,7 +117,7 @@ namespace Ryujinx.Ava
|
|||
private bool _dialogShown;
|
||||
private readonly bool _isFirmwareTitle;
|
||||
|
||||
private readonly object _lockObject = new();
|
||||
private readonly Lock _lock = new();
|
||||
|
||||
public event EventHandler AppExit;
|
||||
public event EventHandler<StatusInitEventArgs> StatusInitEvent;
|
||||
|
@ -339,7 +339,7 @@ namespace Ryujinx.Ava
|
|||
{
|
||||
Task.Run(() =>
|
||||
{
|
||||
lock (_lockObject)
|
||||
lock (_lock)
|
||||
{
|
||||
string applicationName = Device.Processes.ActiveApplication.Name;
|
||||
string sanitizedApplicationName = FileSystemUtils.SanitizeFileName(applicationName);
|
||||
|
|
|
@ -4,6 +4,7 @@ using Ryujinx.Input;
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
using System.Threading;
|
||||
using ConfigKey = Ryujinx.Common.Configuration.Hid.Key;
|
||||
using Key = Ryujinx.Input.Key;
|
||||
|
||||
|
@ -15,7 +16,7 @@ namespace Ryujinx.Ava.Input
|
|||
private readonly AvaloniaKeyboardDriver _driver;
|
||||
private StandardKeyboardInputConfig _configuration;
|
||||
|
||||
private readonly object _userMappingLock = new();
|
||||
private readonly Lock _userMappingLock = new();
|
||||
|
||||
public string Id { get; }
|
||||
public string Name { get; }
|
||||
|
|
Loading…
Reference in a new issue