Revert the removal of PyThreadState_DeleteCurrent() with documentation.
:c:func:`PyThreadState_Clear`.
+ .. c:function:: void PyThreadState_DeleteCurrent()
+
+ Destroy the current thread state and release the global interpreter lock.
+ Like :c:func:`PyThreadState_Delete`, the global interpreter lock need not
+ be held. The thread state must have been reset with a previous call
+ to :c:func:`PyThreadState_Clear`.
+
+
.. c:function:: PY_INT64_T PyInterpreterState_GetID(PyInterpreterState *interp)
Return the interpreter's unique ID. If there was any error in doing
PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_Next(PyInterpreterState *);
PyAPI_FUNC(PyThreadState *) PyInterpreterState_ThreadHead(PyInterpreterState *);
PyAPI_FUNC(PyThreadState *) PyThreadState_Next(PyThreadState *);
+PyAPI_FUNC(void) PyThreadState_DeleteCurrent(void);
typedef struct _frame *(*PyThreadFrameGetter)(PyThreadState *self_);
--- /dev/null
+Revert the removal of PyThreadState_DeleteCurrent() with documentation.
\ No newline at end of file
}
-/* Common code for PyThreadState_Delete() and _PyThreadState_DeleteCurrent() */
+/* Common code for PyThreadState_Delete() and PyThreadState_DeleteCurrent() */
static void
tstate_delete_common(_PyRuntimeState *runtime, PyThreadState *tstate)
{
PyThreadState *tstate = _PyRuntimeGILState_GetThreadState(gilstate);
if (tstate == NULL)
Py_FatalError(
- "_PyThreadState_DeleteCurrent: no current tstate");
+ "PyThreadState_DeleteCurrent: no current tstate");
tstate_delete_common(runtime, tstate);
if (gilstate->autoInterpreterState &&
PyThread_tss_get(&gilstate->autoTSSkey) == tstate)
PyEval_ReleaseLock();
}
+void
+PyThreadState_DeleteCurrent(void)
+{
+ _PyThreadState_DeleteCurrent(&_PyRuntime);
+}
+
/*
* Delete all thread states except the one passed as argument.