Skip to content

gh-111965: Use critical sections to make io.TextIOWrapper thread safe - #112193

Merged
corona10 merged 7 commits into
python:mainfrom
aisk:critical-sections-textiowrapper
Nov 18, 2023
Merged

corona10 merged 7 commits into
python:mainfrom
aisk:critical-sections-textiowrapper

Conversation

@aisk

@aisk aisk commented Nov 17, 2023 •

Copy link
Copy Markdown
Member
@aisk aisk changed the title ssing critical sections to make io.TextIOWrapper thread safe Nov 17, 2023
@@ -0,0 +1 @@
Using critical section to make ``io.TextIOWrapper`` thread safe without GIL.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

As I commented before, NEWS.d is not needed for this task

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Sorry, just noticed it

@colesbury
colesbury self-requested a review November 17, 2023 14:34
@colesbury colesbury changed the title gh-111965: using critical sections to make io.TextIOWrapper thread safe Nov 17, 2023

@colesbury colesbury 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!

@corona10 would you please look over this one as well?

Comment thread Modules/_io/textio.c Outdated
#include "Python.h"
#include "pycore_call.h" // _PyObject_CallMethod()
#include "pycore_codecs.h" // _PyCodecInfo_GetIncrementalDecoder()
#include "pycore_critical_section.h"

@corona10 corona10 Nov 18, 2023 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please add a comment as the same as the other header. // Py_BEGIN_CRITICAL_SECTION()

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Updated

Comment thread Modules/_io/textio.c Resolved
aisk and others added 2 commits November 18, 2023 16:31
Co-authored-by: Donghee Na <donghee.na@python.org>

@corona10 corona10 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm

@corona10
corona10 merged commit 1a969b4 into python:main Nov 18, 2023
@aisk

aisk commented Nov 19, 2023

Copy link
Copy Markdown
Member Author

Thanks for the review!

@aisk
aisk deleted the critical-sections-textiowrapper branch November 19, 2023 06:56
aisk added a commit to aisk/cpython that referenced this pull request Feb 11, 2024
Glyphack pushed a commit to Glyphack/cpython that referenced this pull request Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

3 participants