Use :ref:deadlock-reference-label

This commit is contained in:
Ralf W. Grosse-Kunstleve 2024-10-07 16:37:56 -07:00
parent 5d0e95ca28
commit e5734d275f
No known key found for this signature in database
2 changed files with 5 additions and 5 deletions

View File

@ -1,3 +1,5 @@
.. _deadlock-reference-label:
# Double locking, deadlocking, GIL # Double locking, deadlocking, GIL
[TOC] [TOC]

View File

@ -63,10 +63,8 @@ back into Python.
When writing C++ code that is called from other C++ code, if that code accesses When writing C++ code that is called from other C++ code, if that code accesses
Python state, it must explicitly acquire and release the GIL. A separate Python state, it must explicitly acquire and release the GIL. A separate
document on deadlocks [#f8]_ elaborates on a particularly subtle interaction document on :ref:`deadlock-reference-label` elaborates on a particularly subtle
with C++'s block-scope static variable initializer guard mutexes. interaction with C++'s block-scope static variable initializer guard mutexes.
.. [#f8] deadlock.md
The classes :class:`gil_scoped_release` and :class:`gil_scoped_acquire` can be The classes :class:`gil_scoped_release` and :class:`gil_scoped_acquire` can be
used to acquire and release the global interpreter lock in the body of a C++ used to acquire and release the global interpreter lock in the body of a C++
@ -147,7 +145,7 @@ following checklist.
of exceptions. of exceptions.
- C++ static block-scope variable initialization that calls back into Python can - C++ static block-scope variable initialization that calls back into Python can
cause deadlocks; see [#f8]_ for a detailed discussion. cause deadlocks; see :ref:`deadlock-reference-label` for a detailed discussion.
- You should try running your code in a debug build. That will enable additional assertions - You should try running your code in a debug build. That will enable additional assertions
within pybind11 that will throw exceptions on certain GIL handling errors within pybind11 that will throw exceptions on certain GIL handling errors