summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2020-03-25 20:23:53 (GMT)
committerGitHub <noreply@github.com>2020-03-25 20:23:53 (GMT)
commit5c3cda0d1a850a1a9b43892f48376b8876bd5863 (patch)
tree723a2cb38dfec21de9cabe70d2bc952986788f5f /Python
parent0e427c6d159e86f17270770cd8dc37372e3c4004 (diff)
downloadcpython-5c3cda0d1a850a1a9b43892f48376b8876bd5863.zip
cpython-5c3cda0d1a850a1a9b43892f48376b8876bd5863.tar.gz
cpython-5c3cda0d1a850a1a9b43892f48376b8876bd5863.tar.bz2
bpo-39947: Add PyThreadState_GetID() function (GH-19163)
Add PyThreadState_GetID() function: get the unique identifier of a Python thread state.
Diffstat (limited to 'Python')
-rw-r--r--Python/pystate.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/Python/pystate.c b/Python/pystate.c
index 66a1d3b..246665b 100644
--- a/Python/pystate.c
+++ b/Python/pystate.c
@@ -1021,6 +1021,14 @@ PyThreadState_GetFrame(PyThreadState *tstate)
}
+uint64_t
+PyThreadState_GetID(PyThreadState *tstate)
+{
+ assert(tstate != NULL);
+ return tstate->id;
+}
+
+
/* Asynchronously raise an exception in a thread.
Requested by Just van Rossum and Alex Martelli.
To prevent naive misuse, you must write your own extension