Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions Python/pystate.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ha, is the reason for the problem that the increment was done unlocked?

@skrah skrah Mar 2, 2020 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The location is unfortunate, but _PyThreadState_Init(tstate) does not use this field.

tstate->prev = NULL;
tstate->next = interp->tstate_head;
if (tstate->next)
Expand Down