mirror of
https://github.com/pybind/pybind11.git
synced 2026-04-20 14:59:27 +00:00
docs: more warnings about locking and the GIL (#5689)
* docs: more warnings about locking and the GIL Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> * fix require → reacquire typo --------- Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> Co-authored-by: Ralf W. Grosse-Kunstleve <rwgkio@gmail.com>
This commit is contained in:
@@ -365,8 +365,13 @@ TEST_CASE("Threads") {
|
||||
py::gil_scoped_acquire gil{};
|
||||
#ifdef Py_GIL_DISABLED
|
||||
# if PY_VERSION_HEX < 0x030E0000
|
||||
// This will not run with the GIL, so it won't deadlock. That's
|
||||
// because of how we run our tests. Be more careful of
|
||||
// deadlocks if the "free-threaded" GIL could be enabled (at
|
||||
// runtime).
|
||||
std::lock_guard<std::mutex> lock(mutex);
|
||||
# else
|
||||
// CPython's thread-safe API in no-GIL mode.
|
||||
py::scoped_critical_section lock(locals);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user