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

Commitc455ee4

Browse files
committed
Rename to GetPythonThreadID
1 parentf077caf commitc455ee4

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

‎CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ This document follows the conventions laid out in [Keep a CHANGELOG][].
1111

1212
- Ability to instantiate new .NET arrays using`Array[T](dim1, dim2, ...)` syntax
1313
- Python operator method will call C# operator method for supported binary and unary operators ([#1324][p1324]).
14-
- AddGetNativeThreadID and Interrupt methods in PythonEngine
14+
- AddGetPythonThreadID and Interrupt methods in PythonEngine
1515

1616
###Changed
1717
- Drop support for Python 2, 3.4, and 3.5

‎src/embed_tests/TestInterrupt.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ public void Dispose()
3131
publicvoidInterruptTest()
3232
{
3333
intrunSimpleStringReturnValue=int.MinValue;
34-
ulongnativeThreadID=ulong.MinValue;
34+
ulongpythonThreadID=ulong.MinValue;
3535
Task.Factory.StartNew(()=>
3636
{
3737
using(Py.GIL())
3838
{
39-
nativeThreadID=PythonEngine.GetNativeThreadID();
39+
pythonThreadID=PythonEngine.GetPythonThreadID();
4040
runSimpleStringReturnValue=PythonEngine.RunSimpleString(@"
4141
import time
4242
@@ -47,11 +47,11 @@ import time
4747

4848
Thread.Sleep(200);
4949

50-
Assert.AreNotEqual(ulong.MinValue,nativeThreadID);
50+
Assert.AreNotEqual(ulong.MinValue,pythonThreadID);
5151

5252
using(Py.GIL())
5353
{
54-
intinterruptReturnValue=PythonEngine.Interrupt(nativeThreadID);
54+
intinterruptReturnValue=PythonEngine.Interrupt(pythonThreadID);
5555
Assert.AreEqual(1,interruptReturnValue);
5656
}
5757

‎src/runtime/pythonengine.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -568,28 +568,28 @@ public static void Exec(string code, IntPtr? globals = null, IntPtr? locals = nu
568568
}
569569

570570
/// <summary>
571-
/// Gets thenative thread ID.
571+
/// Gets thePython thread ID.
572572
/// </summary>
573-
/// <returns>Thenative thread ID.</returns>
574-
publicstaticulongGetNativeThreadID()
573+
/// <returns>ThePython thread ID.</returns>
574+
publicstaticulongGetPythonThreadID()
575575
{
576-
dynamicthreading=Py.Import("threading");
577-
returnthreading.get_ident();
576+
varthreading=Py.Import("threading");
577+
returnthreading.InvokeMethod("get_ident");
578578
}
579579

580580
/// <summary>
581581
/// Interrupts the execution of a thread.
582582
/// </summary>
583-
/// <param name="nativeThreadID">Thenative thread ID.</param>
583+
/// <param name="pythonThreadID">ThePython thread ID.</param>
584584
/// <returns>The number of thread states modified; this is normally one, but will be zero if the thread id isn’t found.</returns>
585-
publicstaticintInterrupt(ulongnativeThreadID)
585+
publicstaticintInterrupt(ulongpythonThreadID)
586586
{
587587
if(RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
588588
{
589-
returnRuntime.PyThreadState_SetAsyncExcLLP64((uint)nativeThreadID,Exceptions.KeyboardInterrupt);
589+
returnRuntime.PyThreadState_SetAsyncExcLLP64((uint)pythonThreadID,Exceptions.KeyboardInterrupt);
590590
}
591591

592-
returnRuntime.PyThreadState_SetAsyncExcLP64(nativeThreadID,Exceptions.KeyboardInterrupt);
592+
returnRuntime.PyThreadState_SetAsyncExcLP64(pythonThreadID,Exceptions.KeyboardInterrupt);
593593
}
594594

595595
/// <summary>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp