Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit90a08b6

Browse files
committed
Try using ulong and long
1 parent5421a85 commit90a08b6

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

‎src/embed_tests/TestInterrupt.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public void Dispose()
3131
publicvoidInterruptTest()
3232
{
3333
intrunSimpleStringReturnValue=int.MinValue;
34-
uintnativeThreadID=uint.MinValue;
34+
ulongnativeThreadID=uint.MinValue;
3535
Task.Factory.StartNew(()=>
3636
{
3737
using(Py.GIL())

‎src/runtime/pythonengine.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ public class PythonEngine : IDisposable
1616
privatestaticexternuintGetCurrentThreadId();
1717

1818
[DllImport("libc",EntryPoint="pthread_self")]
19-
privatestaticexternUIntPtrpthread_selfLinux();
19+
privatestaticexternulongpthread_selfLinux();
2020

2121
[DllImport("pthread",EntryPoint="pthread_self",CallingConvention=CallingConvention.Cdecl)]
22-
privatestaticexternuintpthread_selfOSX();
22+
privatestaticexternulongpthread_selfOSX();
2323

2424
publicstaticShutdownModeShutdownMode
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-
publicstaticuintGetNativeThreadID()
583+
publicstaticulongGetNativeThreadID()
584584
{
585585
if(RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
586586
{
@@ -589,7 +589,7 @@ public static uint GetNativeThreadID()
589589

590590
if(RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
591591
{
592-
returnpthread_selfLinux().ToUInt32();
592+
returnpthread_selfLinux();
593593
}
594594

595595
if(RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
@@ -605,24 +605,24 @@ public static uint GetNativeThreadID()
605605
/// </summary>
606606
/// <param name="nativeThreadID">The native thread ID.</param>
607607
/// <returns>The number of thread states modified; this is normally one, but will be zero if the thread id isn’t found.</returns>
608-
publicstaticintInterrupt(uintnativeThreadID)
608+
publicstaticintInterrupt(ulongnativeThreadID)
609609
{
610610
if(Runtime.PyVersion>=newVersion(3,7))
611611
{
612612
if(RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
613613
{
614-
returnRuntime.PyThreadState_SetAsyncExc37Windows(nativeThreadID,Exceptions.KeyboardInterrupt);
614+
returnRuntime.PyThreadState_SetAsyncExc37Windows((uint)nativeThreadID,Exceptions.KeyboardInterrupt);
615615
}
616616

617-
returnRuntime.PyThreadState_SetAsyncExc37NonWindows(newUIntPtr(nativeThreadID),Exceptions.KeyboardInterrupt);
617+
returnRuntime.PyThreadState_SetAsyncExc37NonWindows(nativeThreadID,Exceptions.KeyboardInterrupt);
618618
}
619619

620620
if(RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
621621
{
622622
returnRuntime.PyThreadState_SetAsyncExc36Windows((int)nativeThreadID,Exceptions.KeyboardInterrupt);
623623
}
624624

625-
returnRuntime.PyThreadState_SetAsyncExc36NonWindows(newIntPtr(nativeThreadID),Exceptions.KeyboardInterrupt);
625+
returnRuntime.PyThreadState_SetAsyncExc36NonWindows((long)nativeThreadID,Exceptions.KeyboardInterrupt);
626626
}
627627

628628
/// <summary>

‎src/runtime/runtime.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2150,10 +2150,10 @@ internal static void Py_CLEAR(ref IntPtr ob)
21502150
internalstaticexternint PyThreadState_SetAsyncExc36Windows(int id, IntPtr exc);
21512151

21522152
[DllImport(_PythonDll, EntryPoint= "PyThreadState_SetAsyncExc", CallingConvention= CallingConvention.Cdecl)]
2153-
internalstaticexternint PyThreadState_SetAsyncExc37NonWindows(UIntPtr id, IntPtr exc);
2153+
internalstaticexternint PyThreadState_SetAsyncExc37NonWindows(ulong id, IntPtr exc);
21542154

21552155
[DllImport(_PythonDll, EntryPoint= "PyThreadState_SetAsyncExc", CallingConvention= CallingConvention.Cdecl)]
2156-
internalstaticexternint PyThreadState_SetAsyncExc36NonWindows(IntPtr id, IntPtr exc);
2156+
internalstaticexternint PyThreadState_SetAsyncExc36NonWindows(long id, IntPtr exc);
21572157

21582158
[DllImport(_PythonDll, CallingConvention= CallingConvention.Cdecl)]
21592159
internalstaticexternint Py_MakePendingCalls();

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp