-
-
Notifications
You must be signed in to change notification settings - Fork 30.7k
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
Add variant of Py_BEGIN_CRITICAL_SECTION
that accepts a NULL
argument
#115432
Labels
Comments
colesbury
added
type-feature
A feature request or enhancement
topic-free-threading
labels
Feb 13, 2024
colesbury
added a commit
to colesbury/cpython
that referenced
this issue
Feb 13, 2024
This adds `Py_BEGIN_CRITICAL_SECTION_OPT` and `Py_END_CRITICAL_SECTION_OPT`, which accept a possibly NULL object as an argument. If the argument is NULL, then nothing is locked or unlocked. Otherwise, they behave like `Py_BEGIN/END_CRITICAL_SECTION`.
colesbury
added a commit
that referenced
this issue
Feb 15, 2024
…115433) This adds `Py_XBEGIN_CRITICAL_SECTION` and `Py_XEND_CRITICAL_SECTION`, which accept a possibly NULL object as an argument. If the argument is NULL, then nothing is locked or unlocked. Otherwise, they behave like `Py_BEGIN/END_CRITICAL_SECTION`.
It turns out that we are not using this in |
diegorusso
pushed a commit
to diegorusso/cpython
that referenced
this issue
Apr 17, 2024
…ect (python#115433) This adds `Py_XBEGIN_CRITICAL_SECTION` and `Py_XEND_CRITICAL_SECTION`, which accept a possibly NULL object as an argument. If the argument is NULL, then nothing is locked or unlocked. Otherwise, they behave like `Py_BEGIN/END_CRITICAL_SECTION`.
colesbury
added a commit
to colesbury/cpython
that referenced
this issue
May 9, 2024
…NULL object (python#115433)" This reverts commit ad4f909. The API ended up not being used.
colesbury
added a commit
that referenced
this issue
May 9, 2024
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this issue
May 9, 2024
…NULL object (pythonGH-115433)" (pythonGH-118861) This reverts commit ad4f909. The API ended up not being used. (cherry picked from commit 46c8081) Co-authored-by: Sam Gross <colesbury@gmail.com>
SonicField
pushed a commit
to SonicField/cpython
that referenced
this issue
May 10, 2024
…NULL object (python#115433)" (python#118861) This reverts commit ad4f909. The API ended up not being used.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Feature or enhancement
We should add a variant of
Py_BEGIN_CRITICAL_SECTION
/Py_END_CRITICAL_SECTION
that accepts a possiblyNULL
object. If the passed object isNULL
then nothing is locked or unlocked. Otherwise, it behaves likePy_BEGIN_CRITICAL_SECTION
.For example:
This will be useful in making
set
thread-safe. There are a number of functions that take an optionaliterable
that may be NULL. We want to lock it in the cases where it's notNULL
.I don't think we will need a version of
Py_BEGIN_CRITICAL_SECTION2
that accepts optionallyNULL
arguments.Linked PRs
The text was updated successfully, but these errors were encountered: