File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -105,11 +105,20 @@ _PyRuntimeState_ReInitThreads(void)
105105 // This was initially set in _PyRuntimeState_Init().
106106 _PyRuntime .main_thread = PyThread_get_thread_ident ();
107107
108- /* XXX What about the following?
109- * _PyRuntime.interpreters.mutex
110- * _PyRuntime.interpreters.main.id_mutex
111- * _PyRuntime.xidregistry.mutex
112- */
108+ _PyRuntime .interpreters .mutex = PyThread_allocate_lock ();
109+ if (_PyRuntime .interpreters .mutex == NULL ) {
110+ Py_FatalError ("Can't initialize lock for runtime interpreters" );
111+ }
112+
113+ _PyRuntime .interpreters .main -> id_mutex = PyThread_allocate_lock ();
114+ if (_PyRuntime .interpreters .main -> id_mutex == NULL ) {
115+ Py_FatalError ("Can't initialize ID lock for main interpreter" );
116+ }
117+
118+ _PyRuntime .xidregistry .mutex = PyThread_allocate_lock ();
119+ if (_PyRuntime .xidregistry .mutex == NULL ) {
120+ Py_FatalError ("Can't initialize lock for cross-interpreter data registry" );
121+ }
113122}
114123
115124#define HEAD_LOCK () PyThread_acquire_lock(_PyRuntime.interpreters.mutex, \
You can’t perform that action at this time.
0 commit comments