8000 gh-114271: Make `_thread.ThreadHandle` thread-safe in free-threaded builds by mpage · Pull Request #115190 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-114271: Make _thread.ThreadHandle thread-safe in free-threaded builds #115190

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 21 commits into from
Mar 1, 2024
Merged
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
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
Account for handles being cleared after fork
  • Loading branch information
mpage committed Feb 10, 2024
commit 092c2ebd3f0fb03d408b81e47cc61ede8fc6322e
4 changes: 3 additions & 1 deletion Lib/threading.py
Original file line number Diff line number Diff line change
Expand Up @@ -1162,7 +1162,9 @@ def join(self, timeout=None):
self._join_os_thread()

def _join_os_thread(self):
self._handle.join()
# self._handle may be cleared post-fork
if self._handle is not None:
self._handle.join()

def _wait_for_tstate_lock(self, block=True, timeout=-1):
# Issue #18808: wait for the thread state to be gone.
Expand Down
0