Skip to content

Commit f50c931

Browse files
committed
Trying to remove dependency for GetCurrentThreadId
- Was using the kernel32
1 parent 0a59f7a commit f50c931

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/EmberLibConsumer.net/Lawo/Threading/NativeMethods.cs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace Lawo.Threading
88
{
99
using System;
1010
using System.Diagnostics.CodeAnalysis;
11-
using System.Runtime.InteropServices;
11+
//using System.Runtime.InteropServices;
1212

1313
/// <summary>Provides access to native methods.</summary>
1414
/// <threadsafety static="true" instance="false"/>
@@ -17,9 +17,14 @@ public static class NativeMethods
1717
/// <summary>Returns the return value of
1818
/// <see href="https://msdn.microsoft.com/en-us/library/windows/desktop/ms683183.aspx">GetCurrentThreadId</see>.
1919
/// </summary>
20-
[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate", Justification = "Expensive method.")]
21-
[SuppressMessage("Microsoft.Interoperability", "CA1401:PInvokesShouldNotBeVisible", Justification = "Public access to this method is not a security concern.")]
22-
[DllImport("Kernel32.dll")]
23-
public static extern uint GetCurrentThreadId();
20+
//[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate", Justification = "Expensive method.")]
21+
//[SuppressMessage("Microsoft.Interoperability", "CA1401:PInvokesShouldNotBeVisible", Justification = "Public access to this method is not a security concern.")]
22+
//[DllImport("Kernel32.dll")]
23+
//public static extern uint GetCurrentThreadId();
24+
25+
public static int GetCurrentThreadId()
26+
{
27+
return System.Threading.Thread.CurrentThread.ManagedThreadId;
28+
}
2429
}
2530
}

0 commit comments

Comments
 (0)