@@ -903,7 +903,7 @@ _PyInterpreterState_Clear(PyThreadState *tstate)
903903
904904
905905static inline void tstate_deactivate (PyThreadState * tstate );
906- static void tstate_set_detached (PyThreadState * tstate );
906+ static void tstate_set_detached (PyThreadState * tstate , int detached_state );
907907static void zapthreads (PyInterpreterState * interp );
908908
909909void
@@ -1686,7 +1686,7 @@ _PyThreadState_DeleteCurrent(PyThreadState *tstate)
16861686#ifdef Py_GIL_DISABLED
16871687 _Py_qsbr_detach (((_PyThreadStateImpl * )tstate )-> qsbr );
16881688#endif
1689- tstate_set_detached (tstate );
1689+ tstate_set_detached (tstate , _Py_THREAD_DETACHED );
16901690 tstate_delete_common (tstate );
16911691 current_fast_clear (tstate -> interp -> runtime );
16921692 _PyEval_ReleaseLock (tstate -> interp , NULL );
@@ -1859,13 +1859,13 @@ tstate_try_attach(PyThreadState *tstate)
18591859}
18601860
18611861static void
1862- tstate_set_detached (PyThreadState * tstate )
1862+ tstate_set_detached (PyThreadState * tstate , int detached_state )
18631863{
18641864 assert (tstate -> state == _Py_THREAD_ATTACHED );
18651865#ifdef Py_GIL_DISABLED
1866- _Py_atomic_store_int (& tstate -> state , _Py_THREAD_DETACHED );
1866+ _Py_atomic_store_int (& tstate -> state , detached_state );
18671867#else
1868- tstate -> state = _Py_THREAD_DETACHED ;
1868+ tstate -> state = detached_state ;
18691869#endif
18701870}
18711871
@@ -1935,7 +1935,7 @@ detach_thread(PyThreadState *tstate, int detached_state)
19351935 _Py_qsbr_detach (((_PyThreadStateImpl * )tstate )-> qsbr );
19361936#endif
19371937 tstate_deactivate (tstate );
1938- tstate_set_detached (tstate );
1938+ tstate_set_detached (tstate , detached_state );
19391939 current_fast_clear (& _PyRuntime );
19401940 _PyEval_ReleaseLock (tstate -> interp , tstate );
19411941}
0 commit comments