@@ -323,9 +323,9 @@ gc_visit_heaps(PyInterpreterState *interp, mi_block_visit_fun *visitor,
323
323
assert (interp -> stoptheworld .world_stopped );
324
324
325
325
int err ;
326
- HEAD_LOCK ( & _PyRuntime );
326
+ INTERP_THREAD_LOCK ( interp );
327
327
err = gc_visit_heaps_lock_held (interp , visitor , arg );
328
- HEAD_UNLOCK ( & _PyRuntime );
328
+ INTERP_THREAD_UNLOCK ( interp );
329
329
return err ;
330
330
}
331
331
@@ -347,7 +347,7 @@ gc_visit_stackref(_PyStackRef stackref)
347
347
static void
348
348
gc_visit_thread_stacks (PyInterpreterState * interp )
349
349
{
350
- HEAD_LOCK ( & _PyRuntime );
350
+ INTERP_THREAD_LOCK ( interp );
351
351
for (PyThreadState * p = interp -> threads .head ; p != NULL ; p = p -> next ) {
352
352
_PyInterpreterFrame * f = p -> current_frame ;
353
353
while (f != NULL ) {
@@ -361,7 +361,7 @@ gc_visit_thread_stacks(PyInterpreterState *interp)
361
361
f = f -> previous ;
362
362
}
363
363
}
364
- HEAD_UNLOCK ( & _PyRuntime );
364
+ INTERP_THREAD_UNLOCK ( interp );
365
365
}
366
366
367
367
static void
@@ -397,13 +397,13 @@ process_delayed_frees(PyInterpreterState *interp)
397
397
_Py_qsbr_advance (& interp -> qsbr );
398
398
_PyThreadStateImpl * current_tstate = (_PyThreadStateImpl * )_PyThreadState_GET ();
399
399
_Py_qsbr_quiescent_state (current_tstate -> qsbr );
400
- HEAD_LOCK ( & _PyRuntime );
400
+ INTERP_THREAD_LOCK ( interp );
401
401
PyThreadState * tstate = interp -> threads .head ;
402
402
while (tstate != NULL ) {
403
403
_PyMem_ProcessDelayed (tstate );
404
404
tstate = (PyThreadState * )tstate -> next ;
405
405
}
406
- HEAD_UNLOCK ( & _PyRuntime );
406
+ INTERP_THREAD_UNLOCK ( interp );
407
407
}
408
408
409
409
// Subtract an incoming reference from the computed "gc_refs" refcount.
@@ -1185,7 +1185,7 @@ gc_collect_internal(PyInterpreterState *interp, struct collection_state *state,
1185
1185
state -> gcstate -> old [i - 1 ].count = 0 ;
1186
1186
}
1187
1187
1188
- HEAD_LOCK ( & _PyRuntime );
1188
+ INTERP_THREAD_LOCK ( interp );
1189
1189
for (PyThreadState * p = interp -> threads .head ; p != NULL ; p = p -> next ) {
1190
1190
_PyThreadStateImpl * tstate = (_PyThreadStateImpl * )p ;
1191
1191
@@ -1195,7 +1195,7 @@ gc_collect_internal(PyInterpreterState *interp, struct collection_state *state,
1195
1195
// merge refcounts for all queued objects
1196
1196
merge_queued_objects (tstate , state );
1197
1197
}
1198
- HEAD_UNLOCK ( & _PyRuntime );
1198
+ INTERP_THREAD_UNLOCK ( interp );
1199
1199
1200
1200
process_delayed_frees (interp );
1201
1201
@@ -1953,13 +1953,13 @@ PyUnstable_GC_VisitObjects(gcvisitobjects_t callback, void *arg)
1953
1953
void
1954
1954
_PyGC_ClearAllFreeLists (PyInterpreterState * interp )
1955
1955
{
1956
- HEAD_LOCK ( & _PyRuntime );
1956
+ INTERP_THREAD_LOCK ( interp );
1957
1957
_PyThreadStateImpl * tstate = (_PyThreadStateImpl * )interp -> threads .head ;
1958
1958
while (tstate != NULL ) {
1959
1959
_PyObject_ClearFreeLists (& tstate -> freelists , 0 );
1960
1960
tstate = (_PyThreadStateImpl * )tstate -> base .next ;
1961
1961
}
1962
- HEAD_UNLOCK ( & _PyRuntime );
1962
+ INTERP_THREAD_UNLOCK ( interp );
1963
1963
}
1964
1964
1965
1965
#endif // Py_GIL_DISABLED
0 commit comments