diff --git a/docs/advanced/deadlock.md b/docs/advanced/deadlock.md index f1bab5bdb..5d53064a7 100644 --- a/docs/advanced/deadlock.md +++ b/docs/advanced/deadlock.md @@ -1,3 +1,5 @@ +.. _deadlock-reference-label: + # Double locking, deadlocking, GIL [TOC] diff --git a/docs/advanced/misc.rst b/docs/advanced/misc.rst index 1732de121..f629264c9 100644 --- a/docs/advanced/misc.rst +++ b/docs/advanced/misc.rst @@ -63,10 +63,8 @@ back into Python. 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 -document on deadlocks [#f8]_ elaborates on a particularly subtle interaction -with C++'s block-scope static variable initializer guard mutexes. - -.. [#f8] deadlock.md +document on :ref:`deadlock-reference-label` elaborates on a particularly subtle +interaction with C++'s block-scope static variable initializer guard mutexes. 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++ @@ -147,7 +145,7 @@ following checklist. of exceptions. - 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 within pybind11 that will throw exceptions on certain GIL handling errors