File tree Expand file tree Collapse file tree 4 files changed +18
-2
lines changed
Expand file tree Collapse file tree 4 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -1035,6 +1035,14 @@ All of the following functions must be called after :c:func:`Py_Initialize`.
10351035 :c:func: `PyThreadState_Clear `.
10361036
10371037
1038+ .. c :function :: void PyThreadState_DeleteCurrent ()
1039+
1040+ Destroy the current thread state and release the global interpreter lock.
1041+ Like :c:func:`PyThreadState_Delete`, the global interpreter lock need not
1042+ be held. The thread state must have been reset with a previous call
1043+ to :c:func:`PyThreadState_Clear`.
1044+
1045+
10381046.. c:function:: PY_INT64_T PyInterpreterState_GetID(PyInterpreterState *interp)
10391047
10401048 Return the interpreter's unique ID. If there was any error in doing
Original file line number Diff line number Diff line change @@ -183,6 +183,7 @@ PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_Head(void);
183183PyAPI_FUNC (PyInterpreterState * ) PyInterpreterState_Next (PyInterpreterState * );
184184PyAPI_FUNC (PyThreadState * ) PyInterpreterState_ThreadHead (PyInterpreterState * );
185185PyAPI_FUNC (PyThreadState * ) PyThreadState_Next (PyThreadState * );
186+ PyAPI_FUNC (void ) PyThreadState_DeleteCurrent (void );
186187
187188typedef struct _frame * (* PyThreadFrameGetter )(PyThreadState * self_ );
188189
Original file line number Diff line number Diff line change 1+ Revert the removal of PyThreadState_DeleteCurrent() with documentation.
Original file line number Diff line number Diff line change @@ -801,7 +801,7 @@ PyThreadState_Clear(PyThreadState *tstate)
801801}
802802
803803
804- /* Common code for PyThreadState_Delete() and _PyThreadState_DeleteCurrent () */
804+ /* Common code for PyThreadState_Delete() and PyThreadState_DeleteCurrent () */
805805static void
806806tstate_delete_common (_PyRuntimeState * runtime , PyThreadState * tstate )
807807{
@@ -857,7 +857,7 @@ _PyThreadState_DeleteCurrent(_PyRuntimeState *runtime)
857857 PyThreadState * tstate = _PyRuntimeGILState_GetThreadState (gilstate );
858858 if (tstate == NULL )
859859 Py_FatalError (
860- "_PyThreadState_DeleteCurrent : no current tstate" );
860+ "PyThreadState_DeleteCurrent : no current tstate" );
861861 tstate_delete_common (runtime , tstate );
862862 if (gilstate -> autoInterpreterState &&
863863 PyThread_tss_get (& gilstate -> autoTSSkey ) == tstate )
@@ -868,6 +868,12 @@ _PyThreadState_DeleteCurrent(_PyRuntimeState *runtime)
868868 PyEval_ReleaseLock ();
869869}
870870
871+ void
872+ PyThreadState_DeleteCurrent (void )
873+ {
874+ _PyThreadState_DeleteCurrent (& _PyRuntime );
875+ }
876+
871877
872878/*
873879 * Delete all thread states except the one passed as argument.
You can’t perform that action at this time.
0 commit comments