@@ -2378,16 +2378,18 @@ PyEval_SetProfileAllThreads(Py_tracefunc func, PyObject *arg)
2378
2378
PyThreadState * this_tstate = _PyThreadState_GET ();
2379
2379
PyInterpreterState * interp = this_tstate -> interp ;
2380
2380
2381
- HEAD_LOCK (& _PyRuntime );
2381
+ _PyRuntimeState * runtime = & _PyRuntime ;
2382
+ HEAD_LOCK (runtime );
2382
2383
PyThreadState * ts = PyInterpreterState_ThreadHead (interp );
2383
- HEAD_UNLOCK (& _PyRuntime );
2384
+ HEAD_UNLOCK (runtime );
2385
+
2384
2386
while (ts ) {
2385
2387
if (_PyEval_SetProfile (ts , func , arg ) < 0 ) {
2386
2388
PyErr_FormatUnraisable ("Exception ignored in PyEval_SetProfileAllThreads" );
2387
2389
}
2388
- HEAD_LOCK (& _PyRuntime );
2390
+ HEAD_LOCK (runtime );
2389
2391
ts = PyThreadState_Next (ts );
2390
- HEAD_UNLOCK (& _PyRuntime );
2392
+ HEAD_UNLOCK (runtime );
2391
2393
}
2392
2394
}
2393
2395
@@ -2407,16 +2409,18 @@ PyEval_SetTraceAllThreads(Py_tracefunc func, PyObject *arg)
2407
2409
PyThreadState * this_tstate = _PyThreadState_GET ();
2408
2410
PyInterpreterState * interp = this_tstate -> interp ;
2409
2411
2410
- HEAD_LOCK (& _PyRuntime );
2412
+ _PyRuntimeState * runtime = & _PyRuntime ;
2413
+ HEAD_LOCK (runtime );
2411
2414
PyThreadState * ts = PyInterpreterState_ThreadHead (interp );
2412
- HEAD_UNLOCK (& _PyRuntime );
2415
+ HEAD_UNLOCK (runtime );
2416
+
2413
2417
while (ts ) {
2414
2418
if (_PyEval_SetTrace (ts , func , arg ) < 0 ) {
2415
2419
PyErr_FormatUnraisable ("Exception ignored in PyEval_SetTraceAllThreads" );
2416
2420
}
2417
- HEAD_LOCK (& _PyRuntime );
2421
+ HEAD_LOCK (runtime );
2418
2422
ts = PyThreadState_Next (ts );
2419
- HEAD_UNLOCK (& _PyRuntime );
2423
+ HEAD_UNLOCK (runtime );
2420
2424
}
2421
2425
}
2422
2426
0 commit comments