Skip to content

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

Closed
wiggin15 wants to merge 1 commit into
python:mainfrom
wiggin15:main
Closed

wiggin15 wants to merge 1 commit into
python:mainfrom
wiggin15:main

Conversation

@wiggin15

@wiggin15 wiggin15 commented May 20, 2024 •

Copy link
Copy Markdown
Contributor

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
@ghost

ghost commented May 20, 2024

Copy link
Copy Markdown

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

2 participants