Skip to content

Commit d1b5dae

Browse files
committed
In the lock statements for .NET 9 and 10 targets now uses a instances of the System.Threading.Lock class
1 parent de878ad commit d1b5dae

37 files changed

+122
-56
lines changed

src/JavaScriptEngineSwitcher.ChakraCore/ChakraCoreJsEngine.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public sealed class ChakraCoreJsEngine : JsEngineBase
9494
/// <summary>
9595
/// Synchronizer of JS engine initialization
9696
/// </summary>
97-
private static readonly object _initializationSynchronizer = new object();
97+
private static readonly Lock _initializationSynchronizer = new Lock();
9898

9999
/// <summary>
100100
/// Flag indicating whether the JS engine is initialized

src/JavaScriptEngineSwitcher.ChakraCore/ChakraCorePrecompiledScript.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ internal sealed class ChakraCorePrecompiledScript : IPrecompiledScript
4545
/// <summary>
4646
/// Synchronizer of the script source code loading
4747
/// </summary>
48-
private readonly object _scriptLoadingSynchronizer = new object();
48+
private readonly Lock _scriptLoadingSynchronizer = new Lock();
4949

5050
/// <summary>
5151
/// Gets a source code of the script
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/JavaScriptEngineSwitcher.ChakraCore/JavaScriptEngineSwitcher.ChakraCore.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@
2525
<Description>JavaScriptEngineSwitcher.ChakraCore contains a `ChakraCoreJsEngine` adapter (wrapper for the ChakraCore).</Description>
2626
<PackageTags>$(PackageCommonTags);ChakraCore</PackageTags>
2727
<PackageReleaseNotes>1. The value of a read-only field in an embedded object or type can no longer be changed;
28-
2. Added support for .NET 10;
29-
3. Performed a migration to the modern C# null/not-null checks.</PackageReleaseNotes>
28+
2. Performed a migration to the modern C# null/not-null checks;
29+
3. Added support for .NET 10;
30+
4. In the `lock` statements for .NET 10 target now uses a instances of the `System.Threading.Lock` class.</PackageReleaseNotes>
3031
</PropertyGroup>
3132

3233
<ItemGroup>

src/JavaScriptEngineSwitcher.ChakraCore/JsRt/TypeMapper.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ internal sealed class TypeMapper : IDisposable
4949
/// <summary>
5050
/// Synchronizer of embedded object storage's initialization
5151
/// </summary>
52-
private readonly object _embeddedObjectStorageInitializationSynchronizer = new object();
52+
private readonly Lock _embeddedObjectStorageInitializationSynchronizer = new Lock();
5353

5454
/// <summary>
5555
/// Flag indicating whether the embedded object storage is initialized
@@ -69,7 +69,7 @@ internal sealed class TypeMapper : IDisposable
6969
/// <summary>
7070
/// Synchronizer of embedded type storage's initialization
7171
/// </summary>
72-
private readonly object _embeddedTypeStorageInitializationSynchronizer = new object();
72+
private readonly Lock _embeddedTypeStorageInitializationSynchronizer = new Lock();
7373

7474
/// <summary>
7575
/// Flag indicating whether the embedded type storage is initialized

src/JavaScriptEngineSwitcher.ChakraCore/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

src/JavaScriptEngineSwitcher.ChakraCore/readme.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,10 @@
3333
=============
3434
1. The value of a read-only field in an embedded object or type can no longer be
3535
changed;
36-
2. Added support for .NET 10;
37-
3. Performed a migration to the modern C# null/not-null checks.
36+
2. Performed a migration to the modern C# null/not-null checks;
37+
3. Added support for .NET 10;
38+
4. In the `lock` statements for .NET 10 target now uses a instances of the
39+
`System.Threading.Lock` class.
3840

3941
=============
4042
DOCUMENTATION

src/JavaScriptEngineSwitcher.Core/JavaScriptEngineSwitcher.Core.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
<Description>JavaScript Engine Switcher determines unified interface for access to the basic features of popular JavaScript engines. This library allows you to quickly and easily switch to using of another JavaScript engine.</Description>
2525
<PackageTags>$(PackageCommonTags)</PackageTags>
2626
<PackageReleaseNotes>1. Added support for .NET 10;
27-
2. Performed a migration to the modern C# null/not-null checks.</PackageReleaseNotes>
27+
2. In the `lock` statements for .NET 10 target now uses a instances of the `System.Threading.Lock` class;
28+
3. Performed a migration to the modern C# null/not-null checks.</PackageReleaseNotes>
2829
</PropertyGroup>
2930

3031
<ItemGroup>

src/JavaScriptEngineSwitcher.Core/Utilities/UniqueDocumentNameManager.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
using System;
22
using System.Collections.Generic;
33
using System.IO;
4+
#if NET10_0_OR_GREATER
5+
using Lock = System.Threading.Lock;
6+
#else
7+
using Lock = System.Object;
8+
#endif
49

510
using JavaScriptEngineSwitcher.Core.Resources;
611

@@ -24,7 +29,7 @@ public sealed class UniqueDocumentNameManager
2429
/// <summary>
2530
/// Synchronizer of unique name storage
2631
/// </summary>
27-
private readonly object _storageSynchronizer = new object();
32+
private readonly Lock _storageSynchronizer = new Lock();
2833

2934

3035
/// <summary>

src/JavaScriptEngineSwitcher.Core/readme.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@
2121
RELEASE NOTES
2222
=============
2323
1. Added support for .NET 10;
24-
2. Performed a migration to the modern C# null/not-null checks.
24+
2. In the `lock` statements for .NET 10 target now uses a instances of the
25+
`System.Threading.Lock` class;
26+
3. Performed a migration to the modern C# null/not-null checks.
2527

2628
=============
2729
DOCUMENTATION

0 commit comments

Comments
 (0)