Skip to content

Commit 6bcda67

Browse files
committed
Rename to GetPythonThreadID
1 parent f077caf commit 6bcda67

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
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-
- Add GetNativeThreadID and Interrupt methods in PythonEngine
14+
- Add GetPythonThreadID 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
public void InterruptTest()
3232
{
3333
int runSimpleStringReturnValue = int.MinValue;
34-
ulong nativeThreadID = ulong.MinValue;
34+
ulong pythonThreadID = 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-
int interruptReturnValue = PythonEngine.Interrupt(nativeThreadID);
54+
int interruptReturnValue = PythonEngine.Interrupt(pythonThreadID);
5555
Assert.AreEqual(1, interruptReturnValue);
5656
}
5757

src/runtime/pythonengine.cs

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

570570
/// <summary>
571-
/// Gets the native thread ID.
571+
/// Gets the Python thread ID.
572572
/// </summary>
573-
/// <returns>The native thread ID.</returns>
574-
public static ulong GetNativeThreadID()
573+
/// <returns>The Python thread ID.</returns>
574+
public static ulong GetPythonThreadID()
575575
{
576576
dynamic threading = Py.Import("threading");
577-
return threading.get_ident();
577+
return threading.InvokeMethod("get_ident");
578578
}
579579

580580
/// <summary>

0 commit comments

Comments
 (0)