@@ -271,7 +271,7 @@ PyInterpreterState_New(void)
271271 return NULL ;
272272 }
273273
274- interp -> tstate_next_unique_id = 0 ;
274+ interp -> threads . next_unique_id = 0 ;
275275
276276 interp -> audit_hooks = NULL ;
277277
@@ -297,7 +297,7 @@ interpreter_clear(PyInterpreterState *interp, PyThreadState *tstate)
297297 }
298298
299299 HEAD_LOCK (runtime );
300- for (PyThreadState * p = interp -> tstate_head ; p != NULL ; p = p -> next ) {
300+ for (PyThreadState * p = interp -> threads . head ; p != NULL ; p = p -> next ) {
301301 PyThreadState_Clear (p );
302302 }
303303 HEAD_UNLOCK (runtime );
@@ -371,7 +371,7 @@ zapthreads(PyInterpreterState *interp, int check_current)
371371 PyThreadState * tstate ;
372372 /* No need to lock the mutex here because this should only happen
373373 when the threads are all really dead (XXX famous last words). */
374- while ((tstate = interp -> tstate_head ) != NULL ) {
374+ while ((tstate = interp -> threads . head ) != NULL ) {
375375 _PyThreadState_Delete (tstate , check_current );
376376 }
377377}
@@ -399,7 +399,7 @@ PyInterpreterState_Delete(PyInterpreterState *interp)
399399 break ;
400400 }
401401 }
402- if (interp -> tstate_head != NULL ) {
402+ if (interp -> threads . head != NULL ) {
403403 Py_FatalError ("remaining threads" );
404404 }
405405 * p = interp -> next ;
@@ -702,12 +702,12 @@ new_threadstate(PyInterpreterState *interp, int init)
702702 }
703703
704704 HEAD_LOCK (runtime );
705- tstate -> id = ++ interp -> tstate_next_unique_id ;
705+ tstate -> id = ++ interp -> threads . next_unique_id ;
706706 tstate -> prev = NULL ;
707- tstate -> next = interp -> tstate_head ;
707+ tstate -> next = interp -> threads . head ;
708708 if (tstate -> next )
709709 tstate -> next -> prev = tstate ;
710- interp -> tstate_head = tstate ;
710+ interp -> threads . head = tstate ;
711711 HEAD_UNLOCK (runtime );
712712
713713 return tstate ;
@@ -930,7 +930,7 @@ tstate_delete_common(PyThreadState *tstate,
930930 tstate -> prev -> next = tstate -> next ;
931931 }
932932 else {
933- interp -> tstate_head = tstate -> next ;
933+ interp -> threads . head = tstate -> next ;
934934 }
935935 if (tstate -> next ) {
936936 tstate -> next -> prev = tstate -> prev ;
@@ -1008,7 +1008,7 @@ _PyThreadState_DeleteExcept(_PyRuntimeState *runtime, PyThreadState *tstate)
10081008 /* Remove all thread states, except tstate, from the linked list of
10091009 thread states. This will allow calling PyThreadState_Clear()
10101010 without holding the lock. */
1011- PyThreadState * list = interp -> tstate_head ;
1011+ PyThreadState * list = interp -> threads . head ;
10121012 if (list == tstate ) {
10131013 list = tstate -> next ;
10141014 }
@@ -1019,7 +1019,7 @@ _PyThreadState_DeleteExcept(_PyRuntimeState *runtime, PyThreadState *tstate)
10191019 tstate -> next -> prev = tstate -> prev ;
10201020 }
10211021 tstate -> prev = tstate -> next = NULL ;
1022- interp -> tstate_head = tstate ;
1022+ interp -> threads . head = tstate ;
10231023 HEAD_UNLOCK (runtime );
10241024
10251025 /* Clear and deallocate all stale thread states. Even if this
@@ -1180,7 +1180,7 @@ PyThreadState_SetAsyncExc(unsigned long id, PyObject *exc)
11801180 * head_mutex for the duration.
11811181 */
11821182 HEAD_LOCK (runtime );
1183- for (PyThreadState * tstate = interp -> tstate_head ; tstate != NULL ; tstate = tstate -> next ) {
1183+ for (PyThreadState * tstate = interp -> threads . head ; tstate != NULL ; tstate = tstate -> next ) {
11841184 if (tstate -> thread_id != id ) {
11851185 continue ;
11861186 }
@@ -1244,7 +1244,7 @@ PyInterpreterState_Next(PyInterpreterState *interp) {
12441244
12451245PyThreadState *
12461246PyInterpreterState_ThreadHead (PyInterpreterState * interp ) {
1247- return interp -> tstate_head ;
1247+ return interp -> threads . head ;
12481248}
12491249
12501250PyThreadState *
@@ -1281,7 +1281,7 @@ _PyThread_CurrentFrames(void)
12811281 PyInterpreterState * i ;
12821282 for (i = runtime -> interpreters .head ; i != NULL ; i = i -> next ) {
12831283 PyThreadState * t ;
1284- for (t = i -> tstate_head ; t != NULL ; t = t -> next ) {
1284+ for (t = i -> threads . head ; t != NULL ; t = t -> next ) {
12851285 InterpreterFrame * frame = t -> cframe -> current_frame ;
12861286 if (frame == NULL ) {
12871287 continue ;
@@ -1334,7 +1334,7 @@ _PyThread_CurrentExceptions(void)
13341334 PyInterpreterState * i ;
13351335 for (i = runtime -> interpreters .head ; i != NULL ; i = i -> next ) {
13361336 PyThreadState * t ;
1337- for (t = i -> tstate_head ; t != NULL ; t = t -> next ) {
1337+ for (t = i -> threads . head ; t != NULL ; t = t -> next ) {
13381338 _PyErr_StackItem * err_info = _PyErr_GetTopmostException (t );
13391339 if (err_info == NULL ) {
13401340 continue ;
0 commit comments