From af28bbad52e28ceb21bf66b9f3cec1f02a5be442 Mon Sep 17 00:00:00 2001 From: Qstick Date: Mon, 9 Jan 2023 22:15:40 -0600 Subject: [PATCH] Use Environment.CurrentManagedThreadId for efficiency System.Environment.CurrentManagedThreadId is a compact and efficient replacement of the Thread.CurrentThread.ManagedThreadId pattern. --- .editorconfig | 1 - src/NzbDrone.Test.Common/ConcurrencyCounter.cs | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.editorconfig b/.editorconfig index a0734b78d..949cf76a3 100644 --- a/.editorconfig +++ b/.editorconfig @@ -194,7 +194,6 @@ dotnet_diagnostic.CA1819.severity = suggestion dotnet_diagnostic.CA1822.severity = suggestion dotnet_diagnostic.CA1823.severity = suggestion dotnet_diagnostic.CA1824.severity = suggestion -dotnet_diagnostic.CA1840.severity = suggestion dotnet_diagnostic.CA1845.severity = suggestion dotnet_diagnostic.CA1846.severity = suggestion dotnet_diagnostic.CA1847.severity = suggestion diff --git a/src/NzbDrone.Test.Common/ConcurrencyCounter.cs b/src/NzbDrone.Test.Common/ConcurrencyCounter.cs index 6ee4554db..f3c12023f 100644 --- a/src/NzbDrone.Test.Common/ConcurrencyCounter.cs +++ b/src/NzbDrone.Test.Common/ConcurrencyCounter.cs @@ -27,7 +27,7 @@ namespace NzbDrone.Test.Common public int Start() { - int threadId = Thread.CurrentThread.ManagedThreadId; + int threadId = Environment.CurrentManagedThreadId; lock (_mutex) { _threads[threadId] = 1;