bpo-39947: Add PyThreadState_GetID() function (GH-19163)

Add PyThreadState_GetID() function: get the unique identifier of a
Python thread state.
This commit is contained in:
Victor Stinner 2020-03-25 21:23:53 +01:00 committed by GitHub
parent 0e427c6d15
commit 5c3cda0d1a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 25 additions and 2 deletions

View file

@ -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