mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
gh-134381: Fix RuntimeError when starting not-yet started Thread after fork (gh-134514)
This commit is contained in:
parent
05a19b5e56
commit
9a2346df86
3 changed files with 29 additions and 0 deletions
|
@ -296,6 +296,12 @@ _PyThread_AfterFork(struct _pythread_runtime_state *state)
|
|||
continue;
|
||||
}
|
||||
|
||||
// Keep handles for threads that have not been started yet. They are
|
||||
// safe to start in the child process.
|
||||
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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue