8000 gh-133296: Publicly expose critical section API that accepts PyMutex by ngoldbaum · Pull Request #135899 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-133296: Publicly expose critical section API that accepts PyMutex #135899

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

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Apply suggestions from code review
Co-authored-by: Sam Gross <colesbury@gmail.com>
  • Loading branch information
ngoldbaum and colesbury authored Jun 24, 2025
commit 6d987c75f755cc2f06f481a39c8a405dcd5ded6d
8 changes: 4 additions & 4 deletions Doc/c-api/init.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2294,7 +2294,7 @@ is resumed, and its locks reacquired. This means the critical section API
provides weaker guarantees than traditional locks -- they are useful because
their behavior is similar to the :term:`GIL`.

Variants that accept :c:type:`PyMutex` instances rather than objects are also
Variants that accept :c:type:`PyMutex` pointers rather than Python objects are also
available. Use these variants to start a critical section in a situation where
there is no :c:type:`PyObject` -- for example, when working with a C type that
does not extend or wrap :c:type:`PyObject` but still needs to call into the C
Expand Down Expand Up @@ -2360,7 +2360,7 @@ code triggered by the finalizer blocks and calls :c:func:`PyEval_SaveThread`.

On the default build, this macro expands to ``{``.

.. versionadded:: 3.15
.. versionadded:: next

.. c:macro:: Py_END_CRITICAL_SECTION()

Expand Down Expand Up @@ -2402,11 +2402,11 @@ code triggered by the finalizer blocks and calls :c:func:`PyEval_SaveThread`.
PyCriticalSection2_BeginMutex(&_py_cs2, m1, m2)

Note that unlike :c:macro:`Py_BEGIN_CRITICAL_SECTION2`, there is no cast for
the second and third arguments - they must be :c:type:`PyMutex` instances.
the second and third arguments - they must be :c:type:`PyMutex` pointers.

On the default build, this macro expands to ``{``.

.. versionadded:: 3.15
.. versionadded:: next

.. c:macro:: Py_END_CRITICAL_SECTION2()

Expand Down
Loading
0