@@ -16,10 +16,10 @@ public class PythonEngine : IDisposable
1616 private static extern uint GetCurrentThreadId ( ) ;
1717
1818 [ DllImport ( "libc" , EntryPoint = "pthread_self" ) ]
19- private static extern IntPtr pthread_selfLinux ( ) ;
19+ private static extern UIntPtr pthread_selfLinux ( ) ;
2020
2121 [ DllImport ( "pthread" , EntryPoint = "pthread_self" , CallingConvention = CallingConvention . Cdecl ) ]
22- private static extern ulong pthread_selfOSX ( ) ;
22+ private static extern uint pthread_selfOSX ( ) ;
2323
2424 public static ShutdownMode ShutdownMode
2525 {
@@ -580,7 +580,7 @@ public static void Exec(string code, IntPtr? globals = null, IntPtr? locals = nu
580580 /// Gets the native thread ID.
581581 /// </summary>
582582 /// <returns>The native thread ID.</returns>
583- public static ulong GetNativeThreadID ( )
583+ public static uint GetNativeThreadID ( )
584584 {
585585 if ( Runtime . PyVersion >= new Version ( 3 , 8 ) )
586586 {
@@ -595,7 +595,7 @@ public static ulong GetNativeThreadID()
595595
596596 if ( RuntimeInformation . IsOSPlatform ( OSPlatform . Linux ) )
597597 {
598- return ( ulong ) pthread_selfLinux ( ) ;
598+ return pthread_selfLinux ( ) . ToUInt32 ( ) ;
599599 }
600600
601601 if ( RuntimeInformation . IsOSPlatform ( OSPlatform . OSX ) )
@@ -611,7 +611,7 @@ public static ulong GetNativeThreadID()
611611 /// </summary>
612612 /// <param name="nativeThreadID">The native thread ID.</param>
613613 /// <returns>The number of thread states modified; this is normally one, but will be zero if the thread id isn’t found.</returns>
614- public static int Interrupt ( ulong nativeThreadID )
614+ public static int Interrupt ( uint nativeThreadID )
615615 {
616616 if ( Runtime . PyVersion >= new Version ( 3 , 7 ) )
617617 {
@@ -620,15 +620,15 @@ public static int Interrupt(ulong nativeThreadID)
620620 return Runtime . PyThreadState_SetAsyncExc37Windows ( nativeThreadID , Exceptions . KeyboardInterrupt ) ;
621621 }
622622
623- return Runtime . PyThreadState_SetAsyncExc37NonWindows ( ( UIntPtr ) nativeThreadID , Exceptions . KeyboardInterrupt ) ;
623+ return Runtime . PyThreadState_SetAsyncExc37NonWindows ( new UIntPtr ( nativeThreadID ) , Exceptions . KeyboardInterrupt ) ;
624624 }
625625
626626 if ( RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) )
627627 {
628- return Runtime . PyThreadState_SetAsyncExc36Windows ( ( long ) nativeThreadID , Exceptions . KeyboardInterrupt ) ;
628+ return Runtime . PyThreadState_SetAsyncExc36Windows ( ( int ) nativeThreadID , Exceptions . KeyboardInterrupt ) ;
629629 }
630630
631- return Runtime . PyThreadState_SetAsyncExc36NonWindows ( ( IntPtr ) nativeThreadID , Exceptions . KeyboardInterrupt ) ;
631+ return Runtime . PyThreadState_SetAsyncExc36NonWindows ( new IntPtr ( nativeThreadID ) , Exceptions . KeyboardInterrupt ) ;
632632 }
633633
634634 /// <summary>
0 commit comments