Skip to content
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

gh-117657: Fix itertools.count thread safety #119267

Closed
wants to merge 1 commit into from
Closed

Conversation

wiggin15
Copy link
Contributor

@wiggin15 wiggin15 commented May 20, 2024

Thread safety in count_next. count_next has two modes. slow mode (obj->cnt set to PY_SSIZE_T_MAX), which now uses the object mutex (only if GIL is disabled) and fast mode, which is either simple cnt++ if GIL is enabled, or uses atomic_compare_exchange if GIL is disabled.

Thread safety in count_next. count_next has two modes. slow mode
(obj->cnt set to PY_SSIZE_T_MAX), which now uses the object mutex
(only if GIL is disabled) and fast mode, which is either simple
cnt++  if GIL is enabled, or uses atomic_compare_exchange if
GIL is disabled.
@wiggin15 wiggin15 requested a review from rhettinger as a code owner May 20, 2024 20:42
Copy link

The following commit authors need to sign the Contributor License Agreement:

Click the button to sign:
CLA not signed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants