8000 gh-59956: Clarify Runtime State Status Expectations by ericsnowcurrently · Pull Request #101308 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-59956: Clarify Runtime State Status Expectations #101308

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
b64ce9f
Factor out tstate_verify_not_active().
ericsnowcurrently Jan 19, 2023
1be0ec4
Drop the check_current param from _PyThreadState_Delete().
ericsnowcurrently Jan 19, 2023
3454bf1
Drop _PyThreadState_Delete().
ericsnowcurrently Jan 19, 2023
a929e32
Unset the "current" thread state before zapping the threads instead o…
ericsnowcurrently Jan 19, 2023
e6ddd92
Only clear the current thread if the interpreter matches.
ericsnowcurrently Jan 19, 2023
36c512f
Always "check_current" in zapthreads().
ericsnowcurrently Jan 19, 2023
d402a82
Do not pass the runtime to _PyThreadState_DeleteExcept().
ericsnowcurrently Jan 19, 2023
2ddfe71
Add some notes, TODO comments, and asserts.
ericsnowcurrently Jan 19, 2023
99de509
Mark the main interpreter as finalizing during runtime fini.
ericsnowcurrently Jan 19, 2023
b77ae5e
Add more notes and TODO comments.
ericsnowcurrently Jan 19, 2023
9ca673c
Make PyThreadState._status more granular.
ericsnowcurrently Jan 19, 2023
8a71957
Add more status fields.
ericsnowcurrently Jan 20, 2023
62d1a93
Add a TODO.
ericsnowcurrently Jan 20, 2023
90cea92
Track active status.
ericsnowcurrently Jan 19, 2023
9965813
Clarify a TODO comment.
ericsnowcurrently Jan 20, 2023
fd5048b
Associate "bound" and "active".
ericsnowcurrently Jan 20, 2023
2105cd6
_PyThreadState_Prealloc() -> _PyThreadState_New()
ericsnowcurrently Jan 23, 2023
8b110cf
Factor out tstate_tss_*().
ericsnowcurrently Jan 24, 2023
ca98d68
current_tss_*() -> gilstate_tss_*().
ericsnowcurrently Jan 24, 2023
4f39976
Add bind_gilstate_tstate() and unbind_gilstate_tstate().
ericsnowcurrently Jan 24, 2023
6e73669
Update some TODO comments.
ericsnowcurrently Jan 24, 2023
cc3540d
Clean up _PyThreadState_Swap() a little.
ericsnowcurrently Jan 24, 2023
1ce3841
Fix the stable ABI.
ericsnowcurrently Jan 25, 2023
121d328
Fixes for multiprocessing.
ericsnowcurrently Jan 25, 2023
8666362
Move a comment.
ericsnowcurrently Jan 25, 2023
52ac2d9
Preserve errno more carefully.
ericsnowcurrently Jan 25, 2023
f7ac19a
Do not call bind_gilstate_tstate() in bind_tstate().
ericsnowcurrently Jan 25, 2023
a338248
Add an assert.
ericsnowcurrently Jan 25, 2023
5be78e9
Clean up bind_gilstate_tstate().
ericsnowcurrently Jan 25, 2023
f019bd6
Clear bound_gilstate for the old thread state.
ericsnowcurrently Jan 25, 2023
6869bfe
bound_gilstate and gilstate_tss_get() must match.
ericsnowcurrently Jan 25, 2023
f91d458
Add a blank line for clarity.
ericsnowcurrently Jan 25, 2023
9b45398
Do not call unbind_gilstate_tstate() in unbind_tstate().
ericsnowcurrently Jan 25, 2023
98a2dae
Fix comments.
ericsnowcurrently Jan 25, 2023
afde196
Fix padding.
ericsnowcurrently Jan 30, 2023
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
Prev Previous commit
Next Next commit
Drop the check_current param from _PyThreadState_Delete().
  • Loading branch information
ericsnowcurrently committed Jan 25, 2023
commit 1be0ec4c0498df1c26a720a28ff5a25e48ff9415
17 changes: 9 additions & 8 deletions Python/pystate.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ extern "C" {
#endif

/* Forward declarations */
static void _PyThreadState_Delete(PyThreadState *tstate, int check_current);
static void _PyThreadState_Delete(PyThreadState *tstate);


/****************************************/
Expand Down Expand Up @@ -775,7 +775,10 @@ zapthreads(PyInterpreterState *interp, int check_current)
/* No need to lock the mutex here because this should only happen
when the threads are all really dead (XXX famous last words). */
while ((tstate = interp->threads.head) != NULL) {
_PyThreadState_Delete(tstate, check_current);
if (check_current) {
tstate_verify_not_active(tstate);
}
_PyThreadState_Delete(tstate);
}
}

Expand Down Expand Up @@ -1320,12 +1323,8 @@ tstate_delete_common(PyThreadState *tstate)
}

static void
_PyThreadState_Delete(PyThreadState *tstate, int check_current)
_PyThreadState_Delete(PyThreadState *tstate)
{
_Py_EnsureTstateNotNULL(tstate);
if (check_current) {
tstate_verify_not_active(tstate);
}
tstate_delete_common(tstate);
free_threadstate(tstate);
}
Expand All @@ -1334,7 +1333,9 @@ _PyThreadState_Delete(PyThreadState *tstate, int check_current)
void
PyThreadState_Delete(PyThreadState *tstate)
{
_PyThreadState_Delete(tstate, 1);
_Py_EnsureTstateNotNULL(tstate);
tstate_verify_not_active(tstate);
_PyThreadState_Delete(tstate);
}


Expand Down
0