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-111965: Use critical sections to make io.TextIOWrapper thread safe #112193

Merged
merged 7 commits into from
Nov 18, 2023

Conversation

aisk
Copy link
Member

@aisk aisk commented Nov 17, 2023

@aisk aisk changed the title ssing critical sections to make io.TextIOWrapper thread safe gh-111965: using 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
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
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 gh-111965: Use critical sections to make io.TextIOWrapper thread safe Nov 17, 2023
Copy link
Contributor

@colesbury colesbury left a comment

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?

@@ -9,6 +9,7 @@
#include "Python.h"
#include "pycore_call.h" // _PyObject_CallMethod()
#include "pycore_codecs.h" // _PyCodecInfo_GetIncrementalDecoder()
#include "pycore_critical_section.h"
Copy link
Member

@corona10 corona10 Nov 18, 2023

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
Member Author

Choose a reason for hiding this comment

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

Updated

Modules/_io/textio.c Outdated Show resolved Hide resolved
aisk and others added 2 commits November 18, 2023 16:31
Co-authored-by: Donghee Na <donghee.na@python.org>
Copy link
Member

@corona10 corona10 left a comment

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
31 of 32 checks passed
@aisk
Copy link
Member Author

aisk commented Nov 19, 2023

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants