diff --git a/SysManager/SysManager/Services/AppAlertService.cs b/SysManager/SysManager/Services/AppAlertService.cs index 7403713..e4a9feb 100644 --- a/SysManager/SysManager/Services/AppAlertService.cs +++ b/SysManager/SysManager/Services/AppAlertService.cs @@ -17,7 +17,7 @@ namespace SysManager.Services; public sealed class AppAlertService : IDisposable { private readonly List _watchers = new(); - private readonly object _watcherLock = new(); + private readonly Lock _watcherLock = new(); private readonly ConcurrentDictionary _knownFolders = new(StringComparer.OrdinalIgnoreCase); private readonly ConcurrentDictionary _knownRegistryApps = new(StringComparer.OrdinalIgnoreCase); private readonly SynchronizationContext? _syncContext; diff --git a/SysManager/SysManager/Services/IconExtractorService.cs b/SysManager/SysManager/Services/IconExtractorService.cs index 4eb6b74..8dd9c15 100644 --- a/SysManager/SysManager/Services/IconExtractorService.cs +++ b/SysManager/SysManager/Services/IconExtractorService.cs @@ -24,7 +24,7 @@ public sealed partial class IconExtractorService { private static readonly ConcurrentDictionary _cache = new(StringComparer.OrdinalIgnoreCase); private static readonly Queue _insertionOrder = new(); - private static readonly object _evictionLock = new(); + private static readonly Lock _evictionLock = new(); /// Maximum number of cached icons before eviction kicks in. public static int MaxCacheSize { get; set; } = 500; diff --git a/SysManager/SysManager/Services/PingMonitorService.cs b/SysManager/SysManager/Services/PingMonitorService.cs index 7df3194..e3f0b5b 100644 --- a/SysManager/SysManager/Services/PingMonitorService.cs +++ b/SysManager/SysManager/Services/PingMonitorService.cs @@ -31,7 +31,7 @@ public sealed class PingMonitorService : IDisposable private CancellationTokenSource? _cts; private Task? _loop; - private readonly object _stateLock = new(); + private readonly Lock _stateLock = new(); public bool IsRunning => _loop is { IsCompleted: false }; diff --git a/SysManager/SysManager/Services/SystemInfoService.cs b/SysManager/SysManager/Services/SystemInfoService.cs index e97de7e..bd2ba41 100644 --- a/SysManager/SysManager/Services/SystemInfoService.cs +++ b/SysManager/SysManager/Services/SystemInfoService.cs @@ -18,7 +18,7 @@ public sealed class SystemInfoService private OsInfo? _cachedOs; private CpuInfo? _cachedCpuStatic; private List? _cachedDisks; - private readonly object _cacheLock = new(); + private readonly Lock _cacheLock = new(); public Task CaptureAsync(CancellationToken ct = default) => Task.Run(() => Capture(), ct); diff --git a/SysManager/SysManager/Services/TracerouteMonitorService.cs b/SysManager/SysManager/Services/TracerouteMonitorService.cs index e972417..15b7bd8 100644 --- a/SysManager/SysManager/Services/TracerouteMonitorService.cs +++ b/SysManager/SysManager/Services/TracerouteMonitorService.cs @@ -32,7 +32,7 @@ public sealed class TracerouteMonitorService : IDisposable private CancellationTokenSource? _cts; private Task? _loop; - private readonly object _stateLock = new(); + private readonly Lock _stateLock = new(); public bool IsRunning => _loop is { IsCompleted: false }; diff --git a/SysManager/SysManager/ViewModels/ConsoleViewModel.cs b/SysManager/SysManager/ViewModels/ConsoleViewModel.cs index 98e85e2..0de50f8 100644 --- a/SysManager/SysManager/ViewModels/ConsoleViewModel.cs +++ b/SysManager/SysManager/ViewModels/ConsoleViewModel.cs @@ -17,7 +17,7 @@ namespace SysManager.ViewModels; public sealed partial class ConsoleViewModel : ObservableObject { private const int MaxLines = 5000; - private readonly object _gate = new(); + private readonly Lock _gate = new(); public ObservableCollection Lines { get; } = new();