Skip to content

gh-134381: Improve thread safety in _PyThread_AfterFork by preserving not-started handles #134514

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 8 commits into from
May 23, 2025
Next Next commit
Improve thread safety in _PyThread_AfterFork by preserving not-starte…
…d handles
  • Loading branch information
zangjiucheng committed May 22, 2025
commit c20f566f3ea7efa5bc1ef195075a2ea156740a9a
5 changes: 5 additions & 0 deletions Modules/_threadmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,11 @@ _PyThread_AfterFork(struct _pythread_runtime_state *state)
continue;
}

// keep not_start handles – they are safe to start in the child
if (handle->state == THREAD_HANDLE_NOT_STARTED){
continue;
}

// Mark all threads as done. Any attempts to join or detach the
// underlying OS thread (if any) could crash. We are the only thread;
// it's safe to set this non-atomically.
Expand Down
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy