Skip to content

Commit 6835a35

Browse files
committed
Use type alias for lock primitive
1 parent 98b88b9 commit 6835a35

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

test/TestBuildingBlocks/CapturingLoggerProvider.cs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
using JetBrains.Annotations;
22
using Microsoft.Extensions.Logging;
3+
using LockPrimitive =
4+
#if NET9_0_OR_GREATER
5+
System.Threading.Lock
6+
#else
7+
object
8+
#endif
9+
;
310

411
namespace TestBuildingBlocks;
512

@@ -9,11 +16,7 @@ public sealed class CapturingLoggerProvider : ILoggerProvider
916
private static readonly Func<string, LogLevel, bool> DefaultFilter = (_, _) => true;
1017
private readonly Func<string, LogLevel, bool> _filter;
1118

12-
#if NET8_0
13-
private readonly object _lockObject = new();
14-
#else
15-
private readonly Lock _lockObject = new();
16-
#endif
19+
private readonly LockPrimitive _lockObject = new();
1720
private readonly List<LogMessage> _messages = [];
1821

1922
public CapturingLoggerProvider()

0 commit comments

Comments
 (0)