Skip to content

Commit 9cb2de0

Browse files
committed
HEAD_LOCK change to INTERP_THREAD_LOCK
1 parent 2378caa commit 9cb2de0

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

Python/gc_free_threading.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -323,9 +323,9 @@ gc_visit_heaps(PyInterpreterState *interp, mi_block_visit_fun *visitor,
323323
assert(interp->stoptheworld.world_stopped);
324324

325325
int err;
326-
HEAD_LOCK(&_PyRuntime);
326+
INTERP_THREAD_LOCK(interp);
327327
err = gc_visit_heaps_lock_held(interp, visitor, arg);
328-
HEAD_UNLOCK(&_PyRuntime);
328+
INTERP_THREAD_UNLOCK(interp);
329329
return err;
330330
}
331331

@@ -347,7 +347,7 @@ gc_visit_stackref(_PyStackRef stackref)
347347
static void
348348
gc_visit_thread_stacks(PyInterpreterState *interp)
349349
{
350-
HEAD_LOCK(&_PyRuntime);
350+
INTERP_THREAD_LOCK(interp);
351351
for (PyThreadState *p = interp->threads.head; p != NULL; p = p->next) {
352352
_PyInterpreterFrame *f = p->current_frame;
353353
while (f != NULL) {
@@ -361,7 +361,7 @@ gc_visit_thread_stacks(PyInterpreterState *interp)
361361
f = f->previous;
362362
}
363363
}
364-
HEAD_UNLOCK(&_PyRuntime);
364+
INTERP_THREAD_UNLOCK(interp);
365365
}
366366

367367
static void
@@ -397,13 +397,13 @@ process_delayed_frees(PyInterpreterState *interp)
397397
_Py_qsbr_advance(&interp->qsbr);
398398
_PyThreadStateImpl *current_tstate = (_PyThreadStateImpl *)_PyThreadState_GET();
399399
_Py_qsbr_quiescent_state(current_tstate->qsbr);
400-
HEAD_LOCK(&_PyRuntime);
400+
INTERP_THREAD_LOCK(interp);
401401
PyThreadState *tstate = interp->threads.head;
402402
while (tstate != NULL) {
403403
_PyMem_ProcessDelayed(tstate);
404404
tstate = (PyThreadState *)tstate->next;
405405
}
406-
HEAD_UNLOCK(&_PyRuntime);
406+
INTERP_THREAD_UNLOCK(interp);
407407
}
408408

409409
// Subtract an incoming reference from the computed "gc_refs" refcount.
@@ -1185,7 +1185,7 @@ gc_collect_internal(PyInterpreterState *interp, struct collection_state *state,
11851185
state->gcstate->old[i-1].count = 0;
11861186
}
11871187

1188-
HEAD_LOCK(&_PyRuntime);
1188+
INTERP_THREAD_LOCK(interp);
11891189
for (PyThreadState *p = interp->threads.head; p != NULL; p = p->next) {
11901190
_PyThreadStateImpl *tstate = (_PyThreadStateImpl *)p;
11911191

@@ -1195,7 +1195,7 @@ gc_collect_internal(PyInterpreterState *interp, struct collection_state *state,
11951195
// merge refcounts for all queued objects
11961196
merge_queued_objects(tstate, state);
11971197
}
1198-
HEAD_UNLOCK(&_PyRuntime);
1198+
INTERP_THREAD_UNLOCK(interp);
11991199

12001200
process_delayed_frees(interp);
12011201

@@ -1953,13 +1953,13 @@ PyUnstable_GC_VisitObjects(gcvisitobjects_t callback, void *arg)
19531953
void
19541954
_PyGC_ClearAllFreeLists(PyInterpreterState *interp)
19551955
{
1956-
HEAD_LOCK(&_PyRuntime);
1956+
INTERP_THREAD_LOCK(interp);
19571957
_PyThreadStateImpl *tstate = (_PyThreadStateImpl *)interp->threads.head;
19581958
while (tstate != NULL) {
19591959
_PyObject_ClearFreeLists(&tstate->freelists, 0);
19601960
tstate = (_PyThreadStateImpl *)tstate->base.next;
19611961
}
1962-
HEAD_UNLOCK(&_PyRuntime);
1962+
INTERP_THREAD_UNLOCK(interp);
19631963
}
19641964

19651965
#endif // Py_GIL_DISABLED

0 commit comments

Comments
 (0)