Skip to content

Commit 88db4ac

Browse files
committed
In the lock statements for .NET 10 target now uses a instances of the System.Threading.Lock class
1 parent 3d847fd commit 88db4ac

12 files changed

+21
-13
lines changed

src/MsieJavaScriptEngine/ActiveScript/ActiveScriptJsEngineBase.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ internal abstract partial class ActiveScriptJsEngineBase : InnerJsEngineBase
107107
/// <summary>
108108
/// Synchronizer of script dispatcher initialization
109109
/// </summary>
110-
private static readonly object _dispatcherSynchronizer = new object();
110+
private static readonly Lock _dispatcherSynchronizer = new Lock();
111111

112112

113113
/// <summary>
@@ -210,7 +210,7 @@ private static void InitScriptDispatcher(int maxStackSize)
210210
/// <param name="isSupported">Flag indicating whether this JS engine is supported</param>
211211
/// <param name="supportSynchronizer">Support synchronizer</param>
212212
/// <returns>Result of check (<c>true</c> - supports; <c>false</c> - does not support)</returns>
213-
protected static bool IsSupported(string clsid, ref bool? isSupported, ref object supportSynchronizer)
213+
protected static bool IsSupported(string clsid, ref bool? isSupported, ref Lock supportSynchronizer)
214214
{
215215
if (isSupported.HasValue)
216216
{

src/MsieJavaScriptEngine/ActiveScript/ChakraActiveScriptJsEngine.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ internal sealed partial class ChakraActiveScriptJsEngine : ActiveScriptJsEngineB
1818
/// <summary>
1919
/// Support synchronizer
2020
/// </summary>
21-
private static object _supportSynchronizer = new object();
21+
private static Lock _supportSynchronizer = new Lock();
2222

2323
/// <summary>
2424
/// Mapping of error numbers and types

src/MsieJavaScriptEngine/ActiveScript/ClassicActiveScriptJsEngine.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ internal sealed partial class ClassicActiveScriptJsEngine : ActiveScriptJsEngine
2020
/// <summary>
2121
/// Support synchronizer
2222
/// </summary>
23-
private static object _supportSynchronizer = new object();
23+
private static Lock _supportSynchronizer = new Lock();
2424

2525
/// <summary>
2626
/// Mapping of error numbers and types
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#if NET10_0_OR_GREATER
2+
global using Lock = System.Threading.Lock;
3+
#else
4+
global using Lock = System.Object;
5+
#endif

src/MsieJavaScriptEngine/JsRt/Edge/ChakraEdgeJsRtJsEngine.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ internal sealed class ChakraEdgeJsRtJsEngine : ChakraJsRtJsEngineBase
5151
/// <summary>
5252
/// Support synchronizer
5353
/// </summary>
54-
private static readonly object _supportSynchronizer = new object();
54+
private static readonly Lock _supportSynchronizer = new Lock();
5555

5656

5757
/// <summary>

src/MsieJavaScriptEngine/JsRt/Ie/ChakraIeJsRtJsEngine.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ internal sealed class ChakraIeJsRtJsEngine : ChakraJsRtJsEngineBase
5959
/// <summary>
6060
/// Support synchronizer
6161
/// </summary>
62-
private static readonly object _supportSynchronizer = new object();
62+
private static readonly Lock _supportSynchronizer = new Lock();
6363

6464

6565
/// <summary>

src/MsieJavaScriptEngine/JsRt/TypeMapper.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ internal abstract class TypeMapper<TValue, TFunction> : IDisposable
4343
/// <summary>
4444
/// Synchronizer of embedded object storage's initialization
4545
/// </summary>
46-
private readonly object _embeddedObjectStorageInitializationSynchronizer = new object();
46+
private readonly Lock _embeddedObjectStorageInitializationSynchronizer = new Lock();
4747

4848
/// <summary>
4949
/// Flag indicating whether the embedded object storage is initialized
@@ -63,7 +63,7 @@ internal abstract class TypeMapper<TValue, TFunction> : IDisposable
6363
/// <summary>
6464
/// Synchronizer of embedded type storage's initialization
6565
/// </summary>
66-
private readonly object _embeddedTypeStorageInitializationSynchronizer = new object();
66+
private readonly Lock _embeddedTypeStorageInitializationSynchronizer = new Lock();
6767

6868
/// <summary>
6969
/// Flag indicating whether the embedded type storage is initialized

src/MsieJavaScriptEngine/MsieJavaScriptEngine.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
<PackageTags>JavaScript;ECMAScript;MSIE;IE;Edge;Chakra</PackageTags>
2727
<PackageReleaseNotes>1. Optimized a memory usage in the `ReflectionHelpers.GetBestFitMethod` method;
2828
2. Added support for .NET Standard 2.1 and .NET 10;
29-
3. Performed a migration to the modern C# null/not-null checks.</PackageReleaseNotes>
29+
3. Performed a migration to the modern C# null/not-null checks;
30+
4. In the `lock` statements for .NET 10 target now uses a instances of the `System.Threading.Lock` class.</PackageReleaseNotes>
3031
<NeutralLanguage>en-US</NeutralLanguage>
3132
<PackageOutputPath>../../nuget</PackageOutputPath>
3233
<GeneratePackageOnBuild Condition=" '$(Configuration)' == 'Release' ">true</GeneratePackageOnBuild>

src/MsieJavaScriptEngine/MsieJsEngine.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public sealed class MsieJsEngine : IDisposable
3333
/// <summary>
3434
/// Synchronizer of JS engines creation
3535
/// </summary>
36-
private static readonly object _creationSynchronizer = new object();
36+
private static readonly Lock _creationSynchronizer = new Lock();
3737

3838
/// <summary>
3939
/// Unique document name manager

src/MsieJavaScriptEngine/ScriptDispatcher.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ internal sealed class ScriptDispatcher : IDisposable
3636
/// <summary>
3737
/// Synchronizer of script task queue
3838
/// </summary>
39-
private readonly object _taskQueueSynchronizer = new object();
39+
private readonly Lock _taskQueueSynchronizer = new Lock();
4040

4141
/// <summary>
4242
/// Flag that object is destroyed

0 commit comments

Comments
 (0)