Skip to content

Commit 5633f82

Browse files
committed
Changed locks to use the new Lock-type for .net9
1 parent 47770c0 commit 5633f82

41 files changed

Lines changed: 128 additions & 19 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

RGB.NET.Core/Compatibility/Lock.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#if NET8_0
2+
3+
namespace RGB.NET.Core.Compatibility.Net8;
4+
5+
public sealed class Lock;
6+
7+
#endif

RGB.NET.Core/Helper/TimerHelper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public static class TimerHelper
2424

2525
#region Properties & Fields
2626

27-
private static readonly object HIGH_RESOLUTION_TIMER_LOCK = new();
27+
private static readonly Lock HIGH_RESOLUTION_TIMER_LOCK = new();
2828

2929
private static bool _areHighResolutionTimersEnabled = false;
3030

RGB.NET.Core/RGB.NET.Core.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@
5252
<DefineConstants>RELEASE</DefineConstants>
5353
</PropertyGroup>
5454

55+
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
56+
<Using Include="RGB.NET.Core.Compatibility.Net8" />
57+
</ItemGroup>
58+
5559
<ItemGroup>
5660
<Content Include="..\Resources\icon.png" Link="icon.png" Pack="true" PackagePath="\" />
5761
<None Include="README.md" Pack="true" PackagePath="\" />

RGB.NET.Core/Update/Devices/UpdateQueue.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using System.Buffers;
33
using System.Collections.Generic;
4+
using System.Threading;
45

56
namespace RGB.NET.Core;
67

@@ -14,7 +15,7 @@ public abstract class UpdateQueue<TIdentifier, TData> : AbstractReferenceCountin
1415
{
1516
#region Properties & Fields
1617

17-
private readonly object _dataLock = new();
18+
private readonly Lock _dataLock = new();
1819
private readonly IDeviceUpdateTrigger _updateTrigger;
1920
private readonly Dictionary<TIdentifier, TData> _currentDataSet = [];
2021

RGB.NET.Core/Update/TimerUpdateTrigger.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public sealed class TimerUpdateTrigger : AbstractUpdateTrigger
1414
{
1515
#region Properties & Fields
1616

17-
private readonly object _lock = new();
17+
private readonly Lock _lock = new();
1818

1919
private readonly CustomUpdateData? _customUpdateData;
2020

RGB.NET.Devices.Asus/AsusDeviceProvider.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
using System;
55
using System.Collections.Generic;
6+
using System.Threading;
67
using AuraServiceLib;
78
using RGB.NET.Core;
89

@@ -17,7 +18,7 @@ public sealed class AsusDeviceProvider : AbstractRGBDeviceProvider
1718
#region Properties & Fields
1819

1920
// ReSharper disable once InconsistentNaming
20-
private static readonly object _lock = new();
21+
private static readonly Lock _lock = new();
2122

2223
private static AsusDeviceProvider? _instance;
2324
/// <summary>

RGB.NET.Devices.Asus/RGB.NET.Devices.Asus.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@
5151
<DefineConstants>RELEASE</DefineConstants>
5252
</PropertyGroup>
5353

54+
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
55+
<Using Include="RGB.NET.Core.Compatibility.Net8" />
56+
</ItemGroup>
57+
5458
<ItemGroup>
5559
<Content Include="..\Resources\icon.png" Link="icon.png" Pack="true" PackagePath="\" />
5660
<None Include="README.md" Pack="true" PackagePath="\" />

RGB.NET.Devices.CoolerMaster/CoolerMasterDeviceProvider.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
using System;
55
using System.Collections.Generic;
6+
using System.Threading;
67
using RGB.NET.Core;
78
using RGB.NET.Devices.CoolerMaster.Helper;
89
using RGB.NET.Devices.CoolerMaster.Native;
@@ -18,7 +19,7 @@ public sealed class CoolerMasterDeviceProvider : AbstractRGBDeviceProvider
1819
#region Properties & Fields
1920

2021
// ReSharper disable once InconsistentNaming
21-
private static readonly object _lock = new();
22+
private static readonly Lock _lock = new();
2223

2324
private static CoolerMasterDeviceProvider? _instance;
2425
/// <summary>

RGB.NET.Devices.CoolerMaster/RGB.NET.Devices.CoolerMaster.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@
5151
<DefineConstants>RELEASE</DefineConstants>
5252
</PropertyGroup>
5353

54+
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
55+
<Using Include="RGB.NET.Core.Compatibility.Net8" />
56+
</ItemGroup>
57+
5458
<ItemGroup>
5559
<Content Include="..\Resources\icon.png" Link="icon.png" Pack="true" PackagePath="\" />
5660
<None Include="README.md" Pack="true" PackagePath="\" />

RGB.NET.Devices.Corsair/CorsairDeviceProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public sealed class CorsairDeviceProvider : AbstractRGBDeviceProvider
1818
#region Properties & Fields
1919

2020
// ReSharper disable once InconsistentNaming
21-
private static readonly object _lock = new();
21+
private static readonly Lock _lock = new();
2222

2323
private static CorsairDeviceProvider? _instance;
2424
/// <summary>

0 commit comments

Comments
 (0)