Skip to content

gh-113884: Refactor queue.SimpleQueue to use a ring buffer to store items - #114259

Merged
erlend-aasland merged 9 commits into
python:mainfrom
mpage:gh-113884-simplequeue-ringbuf-refactor
Jan 19, 2024
Merged

gh-113884: Refactor queue.SimpleQueue to use a ring buffer to store items#114259
erlend-aasland merged 9 commits into
python:mainfrom
mpage:gh-113884-simplequeue-ringbuf-refactor

Conversation

@mpage

@mpagempage commented Jan 18, 2024

Copy link
Copy Markdown
Contributor

Using a ring buffer instead of a Python list will simplify the process of making queue.SimpleQueue thread-safe in free-threaded builds. The ring buffer implementation has no places where critical sections may be released.

Using a ring buffer instead of a Python list will simplify the
process of making `queue.SimpleQueue` thread-safe in free-threaded
builds. The ring buffer implementation has no places where critical
sections may be released.

@colesburycolesbury left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@erlend-aasland, would you be able to review this?

@erlend-aaslanderlend-aasland left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing the refactoring first!

Comment threadModules/_queuemodule.c
Comment threadModules/_queuemodule.c Outdated
Comment threadModules/_queuemodule.c Outdated
Comment threadModules/_queuemodule.c Outdated
Comment threadModules/_queuemodule.c
Comment threadModules/_queuemodule.c Outdated
@rhettinger
rhettinger removed their request for review January 19, 2024 04:12
@mpage

Copy link
Copy Markdown
ContributorAuthor

@erlend-aasland - I think I've addressed all of your comments. Would you please take another look?

@erlend-aasland

Copy link
Copy Markdown
Contributor

Thanks a lot, @mpage and @colesbury 🙏

@erlend-aasland
erlend-aasland merged commit 28eacf2 into python:mainJan 19, 2024
@mpage
mpage deleted the gh-113884-simplequeue-ringbuf-refactor branch January 19, 2024 17:38
kulikjak pushed a commit to kulikjak/cpython that referenced this pull request Jan 22, 2024
… store items (python#114259)
Use a ring buffer instead of a Python list in order to simplify the
process of making queue.SimpleQueue thread-safe in free-threaded
builds. The ring buffer implementation has no places where critical
sections may be released.
aisk pushed a commit to aisk/cpython that referenced this pull request Feb 11, 2024
… store items (python#114259)
Use a ring buffer instead of a Python list in order to simplify the
process of making queue.SimpleQueue thread-safe in free-threaded
builds. The ring buffer implementation has no places where critical
sections may be released.
Glyphack pushed a commit to Glyphack/cpython that referenced this pull request Sep 2, 2024
… store items (python#114259)
Use a ring buffer instead of a Python list in order to simplify the
process of making queue.SimpleQueue thread-safe in free-threaded
builds. The ring buffer implementation has no places where critical
sections may be released.
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@mpage@erlend-aasland@colesbury