summaryrefslogtreecommitdiffstats
path: root/Include/internal/pycore_pythread.h
diff options
context:
space:
mode:
Diffstat (limited to 'Include/internal/pycore_pythread.h')
-rw-r--r--Include/internal/pycore_pythread.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/Include/internal/pycore_pythread.h b/Include/internal/pycore_pythread.h
index f3f5942..a1e084c 100644
--- a/Include/internal/pycore_pythread.h
+++ b/Include/internal/pycore_pythread.h
@@ -152,6 +152,19 @@ PyAPI_FUNC(int) PyThread_join_thread(PyThread_handle_t);
* a non-zero value on failure.
*/
PyAPI_FUNC(int) PyThread_detach_thread(PyThread_handle_t);
+/*
+ * Hangs the thread indefinitely without exiting it.
+ *
+ * gh-87135: There is no safe way to exit a thread other than returning
+ * normally from its start function. This is used during finalization in lieu
+ * of actually exiting the thread. Since the program is expected to terminate
+ * soon anyway, it does not matter if the thread stack stays around until then.
+ *
+ * This is unfortunate for embedders who may not be terminating their process
+ * when they're done with the interpreter, but our C API design does not allow
+ * for safely exiting threads attempting to re-enter Python post finalization.
+ */
+void _Py_NO_RETURN PyThread_hang_thread(void);
#ifdef __cplusplus
}