File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -119,6 +119,8 @@ _Py_brc_merge_refcounts(PyThreadState *tstate)
119
119
struct _brc_thread_state * brc = & ((_PyThreadStateImpl * )tstate )-> brc ;
120
120
struct _brc_bucket * bucket = get_bucket (tstate -> interp , brc -> tid );
121
121
122
+ assert (brc -> tid == _Py_ThreadId ());
123
+
122
124
// Append all objects into a local stack. We don't want to hold the lock
123
125
// while calling destructors.
124
126
PyMutex_Lock (& bucket -> mutex );
Original file line number Diff line number Diff line change @@ -261,6 +261,12 @@ bind_tstate(PyThreadState *tstate)
261
261
tstate -> native_thread_id = PyThread_get_thread_native_id ();
262
262
#endif
263
263
264
+ #ifdef Py_GIL_DISABLED
265
+ // Initialize biased reference counting inter-thread queue. Note that this
266
+ // needs to be initialized from the active thread.
267
+ _Py_brc_init_thread (tstate );
268
+ #endif
269
+
264
270
// mimalloc state needs to be initialized from the active thread.
265
271
tstate_mimalloc_bind (tstate );
266
272
@@ -1412,10 +1418,6 @@ init_threadstate(_PyThreadStateImpl *_tstate,
1412
1418
tstate -> what_event = -1 ;
1413
1419
tstate -> previous_executor = NULL ;
1414
1420
1415
- #ifdef Py_GIL_DISABLED
1416
- // Initialize biased reference counting inter-thread queue
1417
- _Py_brc_init_thread (tstate );
1418
- #endif
1419
1421
llist_init (& _tstate -> mem_free_queue );
1420
1422
1421
1423
if (interp -> stoptheworld .requested || _PyRuntime .stoptheworld .requested ) {
You can’t perform that action at this time.
0 commit comments