diff --git a/docs/api_core.rst b/docs/api_core.rst index ccc2c89d..20efb711 100644 --- a/docs/api_core.rst +++ b/docs/api_core.rst @@ -2737,6 +2737,12 @@ running it in parallel from multiple Python threads. Reacquire the GIL +If you use nanobind in a multi-threaded program, you **must** ensure that +all threads have terminated **before** the interpreter exits. Otherwise any +code that re-acquires the GIL (e.g. for running destructors) will throw a +cancellation exception. This will result in a hard crash because C++ does +not support exceptions in destructors, nor ignoring a cancellation. + Free-threading --------------