File tree Expand file tree Collapse file tree 6 files changed +8
-19
lines changed Expand file tree Collapse file tree 6 files changed +8
-19
lines changed Original file line number Diff line number Diff line change @@ -1023,12 +1023,6 @@ All of the following functions must be called after :c:func:`Py_Initialize`.
1023
1023
The thread state must have been reset with a previous call to
1024
1024
:c:func: `PyThreadState_Clear `.
1025
1025
1026
- .. c :function :: void PyThreadState_DeleteCurrent ()
1027
-
1028
- Destroy the current thread state and release the global interpreter lock.
1029
- interpreter lock need not be held. Like :c:func:`PyThreadState_Delete`, the global
1030
- interpreter lock need not be held. When using :c:func:`PyThreadState_DeleteCurrent`, the thread state must have been reset with a previous
1031
- call to :c:func:`PyThreadState_Clear`.
1032
1026
1033
1027
.. c :function :: PY_INT64_T PyInterpreterState_GetID (PyInterpreterState *interp)
1034
1028
Original file line number Diff line number Diff line change @@ -109,6 +109,8 @@ PyAPI_FUNC(void) _PyErr_Print(PyThreadState *tstate);
109
109
PyAPI_FUNC (void ) _PyErr_Display (PyObject * file , PyObject * exception ,
110
110
PyObject * value , PyObject * tb );
111
111
112
+ PyAPI_FUNC (void ) _PyThreadState_DeleteCurrent (_PyRuntimeState * runtime );
113
+
112
114
#ifdef __cplusplus
113
115
}
114
116
#endif
Original file line number Diff line number Diff line change @@ -50,7 +50,6 @@ PyAPI_FUNC(PyObject*) PyState_FindModule(struct PyModuleDef*);
50
50
PyAPI_FUNC (PyThreadState * ) PyThreadState_New (PyInterpreterState * );
51
51
PyAPI_FUNC (void ) PyThreadState_Clear (PyThreadState * );
52
52
PyAPI_FUNC (void ) PyThreadState_Delete (PyThreadState * );
53
- PyAPI_FUNC (void ) PyThreadState_DeleteCurrent (void );
54
53
55
54
/* Get the current thread state.
56
55
Original file line number Diff line number Diff line change @@ -1025,7 +1025,7 @@ t_bootstrap(void *boot_raw)
1025
1025
PyMem_DEL (boot_raw );
1026
1026
tstate -> interp -> num_threads -- ;
1027
1027
PyThreadState_Clear (tstate );
1028
- PyThreadState_DeleteCurrent ( );
1028
+ _PyThreadState_DeleteCurrent ( & _PyRuntime );
1029
1029
PyThread_exit_thread ();
1030
1030
}
1031
1031
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ static struct {
34
34
#if defined(TRACE_RAW_MALLOC )
35
35
/* This lock is needed because tracemalloc_free() is called without
36
36
the GIL held from PyMem_RawFree(). It cannot acquire the lock because it
37
- would introduce a deadlock in PyThreadState_DeleteCurrent (). */
37
+ would introduce a deadlock in _PyThreadState_DeleteCurrent (). */
38
38
static PyThread_type_lock tables_lock ;
39
39
# define TABLES_LOCK () PyThread_acquire_lock(tables_lock, 1)
40
40
# define TABLES_UNLOCK () PyThread_release_lock(tables_lock)
@@ -728,7 +728,7 @@ tracemalloc_free(void *ctx, void *ptr)
728
728
return ;
729
729
730
730
/* GIL cannot be locked in PyMem_RawFree() because it would introduce
731
- a deadlock in PyThreadState_DeleteCurrent (). */
731
+ a deadlock in _PyThreadState_DeleteCurrent (). */
732
732
733
733
alloc -> free (alloc -> ctx , ptr );
734
734
Original file line number Diff line number Diff line change @@ -809,7 +809,7 @@ PyThreadState_Clear(PyThreadState *tstate)
809
809
}
810
810
811
811
812
- /* Common code for PyThreadState_Delete() and PyThreadState_DeleteCurrent () */
812
+ /* Common code for PyThreadState_Delete() and _PyThreadState_DeleteCurrent () */
813
813
static void
814
814
tstate_delete_common (_PyRuntimeState * runtime , PyThreadState * tstate )
815
815
{
@@ -858,14 +858,14 @@ PyThreadState_Delete(PyThreadState *tstate)
858
858
}
859
859
860
860
861
- static void
861
+ void
862
862
_PyThreadState_DeleteCurrent (_PyRuntimeState * runtime )
863
863
{
864
864
struct _gilstate_runtime_state * gilstate = & runtime -> gilstate ;
865
865
PyThreadState * tstate = _PyRuntimeGILState_GetThreadState (gilstate );
866
866
if (tstate == NULL )
867
867
Py_FatalError (
868
- "PyThreadState_DeleteCurrent : no current tstate" );
868
+ "_PyThreadState_DeleteCurrent : no current tstate" );
869
869
tstate_delete_common (runtime , tstate );
870
870
if (gilstate -> autoInterpreterState &&
871
871
PyThread_tss_get (& gilstate -> autoTSSkey ) == tstate )
@@ -876,12 +876,6 @@ _PyThreadState_DeleteCurrent(_PyRuntimeState *runtime)
876
876
PyEval_ReleaseLock ();
877
877
}
878
878
879
- void
880
- PyThreadState_DeleteCurrent ()
881
- {
882
- _PyThreadState_DeleteCurrent (& _PyRuntime );
883
- }
884
-
885
879
886
880
/*
887
881
* Delete all thread states except the one passed as argument.
You can’t perform that action at this time.
0 commit comments