8000 GH-100892: consolidate `HEAD_LOCK/HEAD_UNLOCK` macros (#100953) · python/cpython@f6307d4 · GitHub
[go: up one dir, main page]

Skip to content

Commit f6307d4

Browse files
GH-100892: consolidate HEAD_LOCK/HEAD_UNLOCK macros (#100953)
1 parent 206f05a commit f6307d4

File tree

4 files changed

+6
-14
lines changed

4 files changed

+6
-14
lines changed

Include/internal/pycore_pystate.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,12 @@ PyAPI_FUNC(int) _PyState_AddModule(
162162

163163
PyAPI_FUNC(int) _PyOS_InterruptOccurred(PyThreadState *tstate);
164164

165+
#define HEAD_LOCK(runtime) \
166+
PyThread_acquire_lock((runtime)->interpreters.mutex, WAIT_LOCK)
167+
#define HEAD_UNLOCK(runtime) \
168+
PyThread_release_lock((runtime)->interpreters.mutex)
169+
170+
165171
#ifdef __cplusplus
166172
}
167173
#endif

Modules/_threadmodule.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -839,11 +839,6 @@ local_traverse(localobject *self, visitproc visit, void *arg)
839839
return 0;
840840
}
841841

842-
#define HEAD_LOCK(runtime) \
843-
PyThread_acquire_lock((runtime)->interpreters.mutex, WAIT_LOCK)
844-
#define HEAD_UNLOCK(runtime) \
845-
PyThread_release_lock((runtime)->interpreters.mutex)
846-
847842
static int
848843
local_clear(localobject *self)
849844
{

Python/ceval.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,6 @@
9797
#define _Py_atomic_load_relaxed_int32(ATOMIC_VAL) _Py_atomic_load_relaxed(ATOMIC_VAL)
9898
#endif
9999

100-
#define HEAD_LOCK(runtime) \
101-
PyThread_acquire_lock((runtime)->interpreters.mutex, WAIT_LOCK)
102-
#define HEAD_UNLOCK(runtime) \
103-
PyThread_release_lock((runtime)->interpreters.mutex)
104-
105100
/* Forward declarations */
106101
static PyObject *trace_call_function(
107102
PyThreadState *tstate, PyObject *callable, PyObject **stack,

Python/pystate.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -231,10 +231,6 @@ _PyRuntimeState_ReInitThreads(_PyRuntimeState *runtime)
231231
}
232232
#endif
233233

234-
#define HEAD_LOCK(runtime) \
235-
PyThread_acquire_lock((runtime)->interpreters.mutex, WAIT_LOCK)
236-
#define HEAD_UNLOCK(runtime) \
237-
PyThread_release_lock((runtime)->interpreters.mutex)
238234

239235
/* Forward declaration */
240236
static void _PyGILState_NoteThreadState(

0 commit comments

Comments
 (0)
0