mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
bpo-39776: Lock ++interp->tstate_next_unique_id. (GH-18746) (#18746)
- Threads created by PyGILState_Ensure() could have a duplicate tstate->id.
This commit is contained in:
parent
2d2f85517f
commit
b3b9ade4a3
2 changed files with 7 additions and 2 deletions
|
@ -606,13 +606,12 @@ new_threadstate(PyInterpreterState *interp, int init)
|
|||
tstate->context = NULL;
|
||||
tstate->context_ver = 1;
|
||||
|
||||
tstate->id = ++interp->tstate_next_unique_id;
|
||||
|
||||
if (init) {
|
||||
_PyThreadState_Init(tstate);
|
||||
}
|
||||
|
||||
HEAD_LOCK(runtime);
|
||||
tstate->id = ++interp->tstate_next_unique_id;
|
||||
tstate->prev = NULL;
|
||||
tstate->next = interp->tstate_head;
|
||||
if (tstate->next)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue